Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n := io.NextInt()
		if n == 0 {
			break
		}
		a := make([]int, n)
		sum := 0
		for i := 0; i < n; i++ {
			a[i] = io.NextInt()
			sum += a[i]
		}
		cnt := 0
		for i := 0; i < n; i++ {
			if a[i] <= sum/n {
				cnt++
			}
		}
		io.Println(cnt)
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  while (true) {
    int n;
    cin >> n;
    if (n == 0) return 0;
    
    vector<int> a(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a.at(i);
      sum += a.at(i);
    }
    
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (a.at(i) * n <= sum) ans++;
    }
    
    cout << ans << '\n';
  }
}

C++: // 2018/12/09 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		int a[10000];
		int sum = 0;
		for(int i=0; i<n; i++){
			cin >> a[i];
			sum += a[i];
		}

		int ave = sum/n;
		int cnt = 0;

		for(int i=0; i<n; i++){
			if(a[i]<=ave){
				cnt++;
			}
		}

		cout << cnt << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    while (true) {
        int n, ans = 0, mean = 0;
        cin >> n;
        if (n == 0) {
            break;
        }
        int a[n];
        for (int i = 0; i < n; i++) {
            cin >> a[i];
            mean += a[i];
        }
        mean /= n;
        for (int i = 0; i < n; i++) {
            if (a[i] <= mean) {
                ans++;
            }
        }
        cout << ans << endl;
    }
}

C++: #include<iostream>
#include<vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    while(n!=0){
      int sum=0,count=0;
      vector<int> a(n);
      for(int i=0;i<n;i++){
          cin >> a[i];
          sum += a[i];
      }
      for(int j=0;j<n;j++){
          if(a[j]<=sum/n){
              count++;
          }
      }
      cout << count << endl;
      cin >> n;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;

int main(void)
{
    int Members, Scores[10001], Total = 0, Poors = 0, i;

    while(true)
    {
        cin >> Members;
        if(!Members){ break; }
        for(i = 0; i < Members; i++)
        {
            cin >> Scores[i];
            Total += Scores[i];
        }
        for(i = 0; i < Members; i++)
        {
            if(Scores[i] * Members <= Total){ Poors++; }
        }
        cout << Poors << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    while(1) {
        int n;
        cin >> n;
        if(n == 0) {
            return 0;
        }
        vector<int> a(n);
        double ave = 0;
        for(int i = 0; i < n; i++) {
            cin >> a[i];
            ave += a[i];
        }
        ave /= (double)n;
        int ans = 0;
        for(int i = 0; i < n; i++) {
            if(ave >= a[i]) {
                ans++;
            }
        }
        cout << ans << endl;
    }
}

C++: #include <bits/stdc++.h>

using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

vector<int>a[50505];
int N[50505];
double ave[50505];
int main() {
	int cnt = 0;
	REP(i, 100010) {
		cin >> N[i];
		if (N[i] == 0)break;
		cnt++;
		ave[i] = 0;
		REP(j, N[i]) {
			int x; cin >> x;
			a[i].push_back(x);
			ave[i] += x;
		}
	}
	//cout << cnt << endl;
	REP(i, cnt) {
		ave[i] /= N[i];
		int ans = 0;
		REP(j, N[i]) {
			if (a[i][j] <= ave[i]) {
				ans++;
			}
		}
		cout << ans << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i, s, e) for(int i = (int)(s); i < (int)(e); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = long long;
int main() {
  int n;
  while(cin >> n) {
    if(n == 0) break;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll sum = 0LL;
    rep(i, n) sum += a[i];
    int ans = 0;
    rep(i, n) if(sum >= a[i] * n) ++ans;
    cout << ans << endl;
  }
  return 0;
}

C++: #include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <numeric>

int testcase_ends() {
  size_t n;
  scanf("%zu", &n);
  if (n == 0) return 1;

  std::vector<int> a(n);
  for (auto& ai: a) scanf("%d", &ai);

  int sum = std::accumulate(a.begin(), a.end(), 0);
  int res = 0;
  for (size_t i = 0; i < n; ++i) {
    if (int(a[i] * n) <= sum) ++res;
  }
  printf("%d\n", res);
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}

C++: #include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;

int main(){
	while(1){
		int n,a[10010],ans=0,cnt=0;
		cin>>n;
		if(n==0)break;
		rep(i,0,n)cin>>a[i],ans+=a[i];
		ans/=n;
		rep(i,0,n)if(ans>=a[i])cnt++;
		print(cnt);
	}
	return 0;
}

C++: #pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
	ll n;
	while(1){
	cin>>n;
	if(n==0)return 0;
	V<ll> a(n);
	ll sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	ll ave=sum/=n;
	int ans=0;
	for(int i=0;i<n;i++)if(a[i]<=ave)ans++;
	cout<<ans<<endl;
	}
}