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;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

vl v(51);
vl p(51);
vl b(51);
ll ans = 0;

void rec(ll n, ll l) {
	if (n == 0)ans += 1;
	else if (l <= 1)return;
	else if (l >= (v[n] - 1) / 2){
		ans += p[n - 1];
		if (l >= (v[n] - 1) / 2 + 1)ans += 1;
		if (l - ((v[n] - 1) / 2 + 1) > 0) {
			rec(n - 1, l - ((v[n] - 1) / 2 + 1));
		}
	}
	else {
		rec(n - 1, l - 1);
	}
}

void solve(ll n) {
	vl v(n);
	ll sum = 0;
	rep(i, n) {
		cin >> v[i];
		sum += v[i];
	}
	ll ans = 0;
	rep(i, n) {
		if (v[i] * n <= sum)ans++ ;
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	while (cin >> n,n) {
		solve(n);
	}
}

C++: //#include "pch.h"
#include <iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdlib.h>
#include<vector>



using namespace std;


int main() {
	
	int num;
	cin >> num;
	while (num != 0) {
		vector<int> money(num);
		for (int i = 0; i < num; i++) {
			cin >> money[i];
		}
		int av = 0;
		for (int i = 0; i < num; i++) {
			av += money[i];
		}
		av /= num;
		int counter = 0;
		for (int i = 0; i < num; i++) {
			if (money[i] <= av)counter++;
		}
		cout << counter << endl;
		cin >> num;
	}
	
}

C++: 
#include <stdio.h>

int main()
{
	int i = 0;
	int n = 0;
	int ave = 0;
	int* a = new int[10000];
	int cnt = 0;

	while (1) {
		
		scanf("%d", &n);

		if (n == 0)break;

		while (1) {
			scanf("%d", &a[i]);
			i++;
			if (i >= n)break;
		}

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

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

		printf("%d\n", cnt);

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

    return 0;
}

C++: #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
#include <set>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
  while (true)
  {
    ll n;
    cin >> n;
    if (n == 0)
      return 0;
    ll mean = 0;
    vector<ll> a(n);
    REP(i, n)
    {
      cin >> a[i];
      mean += a[i];
    }
    ll res = 0;
    REP(i, n)
    {
      if (a[i] * n <= mean)
        res++;
    }
    cout << res << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, int> pli;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

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

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>
#include <numeric>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    while(cin >> n, n){
        vector<int> v(n);
        for (auto &&i : v) scanf("%d", &i);
        int s = accumulate(v.begin(), v.end(), 0);
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            if(v[i]*n <= s) ans++;
        }
        cout << ans << "\n";
    }
    return 0;
}