Go: package main

import "fmt"

func main() {
    var n int
    a := make([]float64, 10004)
    for {
        fmt.Scan(&n)
        if n == 0 { break }

        ave_num := 0.0
        for i := 0; i < n; i++ {
            fmt.Scan(&a[i])
            ave_num += a[i]
        }
        ave_num /= float64(n)
        cnt := 0
        for i := 0; i < n; i++ {
            if a[i] <= ave_num {
                cnt++
            }
        }
        fmt.Println(cnt)
    }
}

C++: #include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int income[10020];


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

	}
}

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

int main(){
  while(true){
    int n, a[100100] = {}, sum = 0, count = 0, N;
    cin>>N;
    if(!N) break;
    for(int i = 1; i <= N; i++){
      cin>>a[i];
      sum += a[i];
    }
    for(int i = 1; i <= N; i++){
      if(a[i]*N <= sum)count++;
    }
    cout<<count<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string.h>
#include<string>
#include<vector>
#include <queue>
#include<cstdio>
#include<algorithm>
#define ls (o << 1)
#define rs (o << 1 | 1)
#define mid ((L + R) >> 1)
using namespace std;
int n;
int main(){
    while(scanf("%d",&n) == 1 && n){
        long long sum = 0;
        vector<long long> a(n);
        for(int i = 0;i < n; ++i){
            scanf("%lld", &a[i]);
            sum += a[i];
        }
        int cnt = 0;
        for(int i = 0;i < n; ++i){
            if(a[i] * n <= sum){
                cnt ++;
            }
        }
        printf("%d\n", cnt);
    }
    
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  while (true) {
    int n; cin >> n;
    if (!n) break;
    V<lint> a(n); for (auto&& e : a) cin >> e;
    lint s = accumulate(begin(a), end(a), 0LL);
    int res = 0;
    for (int i = 0; i < n; ++i) {
      res += n * a[i] <= s;
    }
    cout << res << '\n';
  }
}

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

using namespace std;
using ll = long long;

void suzuken() {
	ll n; scanf("%lld", &n); if (n == 0) exit(0);
	vector<ll> a(n); for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
	sort(a.begin(), a.end());
	ll sum = 0;
	for (int i = 0; i < n; i++) sum += a[i];
	ll res = upper_bound(a.begin(), a.end(), sum / n) - a.begin();
	cout << res << "\n";

}
int main() {
	int kkt = 89;
	while (kkt) {
		suzuken();
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U & u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U & u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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 (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	while (N != 0) {
		vi A(N);
		int sum = 0;
		REP(i, N) {
			cin >> A[i];
			sum += A[i];
		}
		double ave = (double)sum / (double)N;
		int ans = 0;
		REP(i, N) {
			if (ave >= A[i]) {
				ans++;
			}
		}
		cout << ans << endl;
		cin >> N;
	}
	return 0;
}

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

int main(){
  while(1){
    int n;
    cin >> n;

    if(n==0){
      break;
    }

    int a[n];
    int total=0;
    for(int i=0; i<n; i++){
      cin >> a[i];
      total += a[i];
    }

    int mean=total/n;
    int person=0;
    for(int i=0; i<n; i++){
      if(a[i]<=mean){
        person++;
      }
    }

    cout << person << endl;
  }
}

C++: #include <iostream>

using namespace std;

int main(){
  int n[25000] = {0};
  int cnt_in = 0;
  int a[50000] = {0};
  float ave[50000] = {0};
  int bias = 0;

  for(;;){
    cin >> n[cnt_in];
    if(n[cnt_in] == 0){
      break;
    }
    
    long long sum = 0;

    for(int i = 0; i < n[cnt_in]; i++){
      cin >> a[bias + i];
      sum += a[bias+i];
    }
    ave[cnt_in] = sum / (float)n[cnt_in];
    bias += n[cnt_in];
    cnt_in++;
  }
  
  bias = 0;
  for(int i = 0; i < cnt_in; i++){
    int ans = 0;
    for(int j = 0; j < n[i]; j++){
      if(ave[i] >= a[bias+j]){
	ans++;
      }
    }
    cout << ans << endl;
    bias += n[i];
  }

  return 0;
}

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

int main(){
    while(1){
        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 ave = sum/n;
        int ans = 0;
        for(int i=0; i<n; i++){
            if(a[i] <= ave){
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0)
      break;
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
      cin >> a[i];
    int ans = 0;
    long long sum = 0;
    for (int i = 0; i < n; i++)
      sum += a[i];
    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;

int main(){
	int n;
	while(1){
		cin >> n;
		if(!n) break;
		int sum = 0;
		vector<int> a(n);
		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;
}