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;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int n;
int sum=0;
int a[110000];

int main(){
  while(true){

    cin>>n;
    if(n==0) break;
    rep(i,n){
      cin>>a[i];
      sum+=a[i];
    }
    sum/=n;

    int asn=0;
    rep(i,n){
      if(sum<=a[i])
        asn++;
    }

    cout<<asn<<endl;
  }
}

C++: #include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n; cin >> n;
        if(n == 0) return 0;
        else{
            vector<int> person(n);
            double ave = 0;
            REP(i, n){
                cin >> person[i];
                ave += person[i];
            }
            ave /= n;
            int count = 0;
            REP(i, n){
                if(ave >= person[i]) count++;
            }
            cout << count << endl;
        }       
    }
}

C++: //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1616&lang=jp
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <numeric>
#include <functional>
using ll = long long;
using namespace std;

int const MOD = 1e9 + 7;

int main(void)
{
    ll n;
    while (cin >> n, n)
    {
        vector<ll> v(n);
        for (int i = 0; i < n; ++i)
            cin >> v[i];

        ll sum = accumulate(v.begin(), v.end(), 0);
        ll ave = sum / n;

        int ans = 0;
        for (int i = 0; i < n; ++i)
            if (ave >= v[i])
                ans++;
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;
using ll = long long int;
#define long ll

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

    while(1) {
        ll n;
        cin >> n;
        if(!n) break;
        vector<ll> a(n);
        for(auto &e: a) cin >> e;
        sort(a.begin(), a.end());

        ll s = 0;
        for(auto &e: a) s += e;
        s /= n;

        cout << upper_bound(a.begin(), a.end(), s) - a.begin() << endl;;
    }
}

C++: /*  -*- coding: utf-8 -*-
 *
 * 1624.cc: Income Inequality
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 10000;

/* typedef */

/* global variables */

int as[MAX_N];

/* subroutines */

/* main */

int main() {
  for (int n; scanf("%d", &n) == 1 && n > 0;) {
    int sum = 0;
    for (int i = 0; i < n; i++)
      scanf("%d", as + i), sum += as[i];
    sort(as, as + n);

    int k = upper_bound(as, as + n, sum / n) - as;
    printf("%d\n", k);
  }
  return 0;
}

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

int main(){
	int n;
	int a[10000];
	while(true){
		cin >> n;
		if(n==0)
			break;

		for(int i=0; i<n; i++){
			cin >> a[i];
		}
		int ave = 0;
		for(int i=0; i<n; i++){
			ave = ave + a[i];
		}
		ave = ave/n;
		int num = 0;
		for(int i=0; i<n; i++){
			if(a[i]<=ave){
				num++;
			}
		}
		cout << num << endl;
	}
	return 0;
}

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

int main(void){
  while(1){
    int i=0, a[50000], n=0, c=0;
    double ave=0,sum=0;
    cin >> n;
    if(n == 0)
      break;
    for (i = 0; i <n; i++){
      cin >> a[i];
    }
    for(i = 0 ; i < n ; i++){
      sum = sum + a[i];
    }
    ave = sum / n;
    for(i = 0; i < n; i++){
      if(a[i] <= ave)
        c++;
    }
    cout << c << endl;
  }
}

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

namespace {
    int N;
    vector<double> A;
    bool input() {
        cin >> N;
        if (N == 0) return false;
        A.clear();
        A.resize(N, 0);
        for (int i = 0; i < N; i++) {
            cin >> A[i];
        }
        return true;
    }
    void solve() {
        double avg = 0;
        for (int i = 0; i < N; i++) avg += A[i];
        avg /= N;
        int count = 0;
        const double eps = 1e-6;
        for (int i = 0; i < N; i++) {
            count += (A[i] <= avg + eps);
        }
        cout << count << endl;
    }
}

int main() {
    while (input()) solve();
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    vector<int> ans;
    while(true){
        int res = 0;
        int N; cin >> N;
        if(N == 0) break;
        int sum = 0;
        vector<int> A(N);
        rep(i, N){
            int temp; cin >> temp;
            sum += temp;
            A[i] = N*temp;
        }
        rep(i, N){
            if(A[i] <= sum) res++;
        }
        ans.push_back(res);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}