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 <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	while(true){
		int n;
		cin >> n;
		if(n == 0)break;
		vector<int> A(n);
		int sum = 0;
		for(int i = 0; i < n; i ++){
			cin >> A[i];
			sum += A[i];
		}
		int ans = 0;
		for(int i = 0; i < n; i ++){
			if(A[i] * n <= sum)ans ++;
		}
		cout << ans << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

int main() {
  i64 n;
  while(cin >> n, n) {
    vector<i64> a(n);
    rep(i,0,n) cin >> a[i];
    i64 sum = 0;
    rep(i,0,n) sum += a[i];
    sum /= n;
    i64 ans = 0;
    rep(i,0,n) ans += !!(a[i] <= sum);
    cout << ans << endl;
  }
}

C++: #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 (b<a) { a = b; return 1; } return 0; }

int N, A[10101];
//---------------------------------------------------------------------------------------------------
void _main() {
	while (cin >> N) {
		if (N == 0) return;
		rep(i, 0, N) cin >> A[i];

		int sm = 0;
		rep(i, 0, N) sm += A[i];

		int ans = 0;
		rep(i, 0, N) if (A[i] * N <= sm) ans++;
		printf("%d\n", ans);
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){
    int n;
    vector<int> v;
    double ave;
    int result;
    while(cin>>n,n){
        v.resize(n);
        result = 0;
        ave = 0;
        REP(i,n){
            scanf("%d", &v[i]);
            ave += v[i];
        }

        ave /= n;
        REP(i,n){
            if(v[i]<=ave+0.0001){
                result++;
            }
        }

        cout << result << endl;
        
    }

    return 0;
}

C++: #include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  int N;
  while(cin>>N,N){
  vector<int> a(N);
  int avg = 0;
  for (int i=0;i<N;i++) {
    cin>>a[i];
    avg+=a[i];
  }
  avg/=N;
  int ans=0;
  for (int i=0;i<N;i++) {
    if(a[i]<=avg)ans++;
  }
  cout<<ans<<endl;
  }
}

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

int main(void){
    int n, a[10010], s = 0;
    while(1) {
        cin >> n;
        if (n == 0) break;
        s = 0;
        for (int i = 0; i < n; i++) {
            cin >> a[i];
            s += a[i];
        }
        
        int ans = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] * n <= s) ans++;
        }
        
        cout << ans << endl;
    }
}

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

int main(){
  while(true){
    ll n;
    cin>>n;
    if(n==0)break;
    vector<ll> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    ll ave = accumulate(a.begin(), a.end(),0ll)/n;
    int cnt=0;
    for(auto num:a)if(num<=ave)cnt++;
    cout<<cnt<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		vi a(n);
		int s=0;
		for(int i=0;i<n;i++){
			cin>>a[i];
			s+=a[i];
		}
		int res=0;
		for(int i=0;i<n;i++) if(n*a[i]<=s) res++;
		cout<<res<<endl;
	}
}