Go: package main

import "fmt"

func main() {

     for ; true ; {
     var n int
     fmt.Scan(&n)
     if n == 0 { break }
     a := make([]float64, n)
     var sum float64 = 0
     for i := 0; i < n; i++ {
     	 fmt.Scan(&a[i])
	 sum += float64(a[i])
     }
     sum /= float64(n)
     ans := 0
     for i := 0; i < n; i++ {
     	 if a[i] <= sum {
	    ans += 1
	 }
     }
     fmt.Println(ans)
     }
}

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;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define MM 1000000000
#define MOD MM+7
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

long long pow_mod(long long n,long long k,long long m){
    if (k == 0){
        return 1;
    } else if (k % 2 == 1){
        return pow_mod(n,k-1,m)*n % m;
    } else {
        long long t = pow_mod(n,k/2,m);
        return t*t % m;
    }
}


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

C++: //#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
 
 
#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000
 
using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;
 
int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0,0 };
 
int main(void){
	int n;
	int total;
	double ave;
	while(1){
		cin>>n;
		if(n==0){
			break;
		}
		total=0;
		vector<int> a(n);
		ave=0.0;
		FOR(i,0,n-1){
			cin>>a[i];
			ave+=(double)a[i];
		}
		ave/=(double)n;

		FOR(i,0,n-1){
			if((double)a[i]<=ave){
				total++;
			}
		}

		cout<<total<<endl;


	}

}