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(void){
    int n;
    double a;
    while (cin>>n) {
        if (n==0) {
            break;
        } else {
            std::deque<double> deq;
            double sum=0;
            for (int i=0;i<n;i++) {
                cin>>a;
                deq.emplace_back(a);
                sum+=a;
            }
            double ave=sum/n;
            int count=0;
            for (int j=0;j<n;j++) {
                if (deq[j]<=ave) {
                    count++;
                }
            }
            cout<<count<<endl;
        }
    }
}

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

int main(void){
    while(true){
        int n, ans = 0;
        double total = 0, ave;
        cin >> n;
        if(n == 0) break;
        vector<int> a(n);
        for(int i = 0; i < a.size(); i++){
            cin >> a[i];
        }
        for(int i = 0; i < a.size(); i++){
            total += a[i];
        }
        ave = total / n;

        for(int i = 0; i < a.size(); i++){
            if((double)a[i] <= ave) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include<cstdio>
using namespace std;
typedef long long ll;

ll n, a[10000], ans, sum;

int main() {
  while (scanf("%lld", &n), n) {
    sum = ans = 0;
    for (ll i = 0; i < n; i++) scanf("%lld", &a[i]), sum += a[i];
    for (ll i = 0; i < n; i++) if (a[i] * n <= sum) ans++;
    printf("%lld\n", ans);
  }
}

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

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

    int n;
    while(cin >> n){
        if(n == 0) break;
        vector<int> A(n);
        int total = 0;
        for(int i = 0; i < n; i++){
            cin >> A[i];
            total += A[i];
        }
        sort(A.begin(), A.end());
        int average = total / n;
        int cnt = 0;
        for(int i = 0; i < n; i++){
            if(A[i] <= average) cnt++;
            else break;
        }
        cout << cnt << endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
void f(int n){
    // Your code here!
    ll s[n];
    ll tot=0;
    for(int i=0;i<n;i++){
        cin>>s[i];
        tot+=s[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(tot/n>=s[i])ans++;
    }
    cout<<ans<<endl;
}
int main(void){
    while(true){
        int N;
        cin>>N;
        if(N==0)break;
        f(N);
    }
    return 0;
}

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

using ll = long long;

ll SumFrom1ToN(ll n)
{
    return (1 + n) * n / 2;
}

int main()
{
    using namespace std;

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

        if (n == 0)
            break;

        vector<ll> a(n);
        for (auto& e : a)
            cin >> e;

        auto sum = accumulate(a.cbegin(), a.cend(), 0ll);
        auto mean = sum / n;
        auto c = count_if(a.cbegin(), a.cend(), [mean](auto x){return x <= mean;});

        cout << c << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int n;
    while (1) {
        cin >> n;
        if (n == 0) return 0;
        i64 sum = 0;
        vi as;
        for (int i = 0; i < n; i++) {
            int a;
            cin >> a;
            as.push_back(a);
            sum += a;
        }
        int cnt = 0;
        for (int a: as) {
            if (a <= sum / n) cnt++;
        }
        cout << cnt << endl;
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    while(true){
        int n; cin >> n;
        if(n == 0)break;
        int sum = 0;
        int a[n];
        rep(i,n){
            cin >> a[i];
            sum += a[i];
        }
        int avg = sum / n;
        int ans = 0;
        rep(i,n)if(a[i] <= avg)ans++;
        cout << ans << endl;
    }
    
    return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while (cin >> n, n) {
		vl v(n);
		ll sum = 0;
		REP(i, n) {
			cin >> v[i];
			sum += v[i];
		}
		int cnt = 0;
		REP(i, n) {
			if (v[i] * n <= sum)cnt++;
		}
		cout << cnt << endl;
	}

}