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 <iostream>
#include <cmath>
#include <utility>
#include <functional>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

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

	while (n) {
		vector<int> income(n);
		rep(i, 0, n) cin >> income[i];

		int sum = 0;
		rep(i,0,n) sum += income[i];
		int ave = sum / n, ans = 0;

		rep(i, 0, n) {
			if (income[i] <= ave) ans++;
		}

		cout << ans << endl;

		cin >> n;
	}

	return 0;
}

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

int main()
{
    vector<int> ans;
    while (1)
    {
        int n;
        cin >> n;
        if (n == 0)
        {
            break;
        }

        vector<int> inputList;
        int sum = 0;

        for (int i = 0; i < n; i++)
        {
            int a;
            cin >> a;
            inputList.push_back(a);
            sum += a;
        }

        int ave = sum / n;
        int num = 0;

        for (int i = 0; i < n; i++)
        {
            if (inputList[i] <= ave)
            {
                num++;
            }
        }

        ans.push_back(num);
    }

    for (int i = 0; i < ans.size(); i++)
    {
        cout << ans[i] << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

int main()
{
    while (cin >> N)
    {
        if (N == 0)
            return 0;
        vector<int> a(N);
        int sum = 0, ans = 0;
        for (int i = 0; i < N; i++)
        {
            cin >> a[i];
            sum += a[i];
        }
        sum /= N;
        for (int i = 0; i < N; i++)
        {
            if (a[i] <= sum)
                ans++;
        }
        cout << ans << endl;
    }
}

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

int N,A[10010];
int main(){
	while(cin>>N && N>0){
		int sum = 0;
		for(int i=1;i<=N;i++){
			cin >> A[i];
			sum += A[i];
		}
		int ans = 0;
		for(int i=1;i<=N;i++){
			if(A[i]*N<=sum) ans++;
		}
		cout << ans << endl;
	}
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn = 1e4 + 5;
int n, a[maxn];

int main() {
	while (scanf("%d", &n) && n != 0) {
		int sum = 0, num = 0;
		for (int i = 0; i < n; i++) {
			scanf("%d", &a[i]);
			sum += a[i];
		}
		sum /= n;
		for (int i = 0; i < n; i++) {
			if (a[i] <= sum)num++;
		}
		printf("%d\n", num);
	}
	return 0;
}

C++: #include <iostream>

int main(void)
{
    using namespace std;
    int Members, Scores[10000], Total = 0, Average, Poors = 0, i;

    while(true)
    {
        cin >> Members;
        for(i = 0; i < Members; i++)
        {
            Scores[i] = 0;
        }
        for(i = 0; i < Members; i++)
        {
            cin >> Scores[i];
        }
        for(i = 0; i < Members; i++)
        {
            Total = Total + Scores[i];
        }
        Average = Total / Members;
        for(i = 0; i < Members; i++)
        {
            if(Scores[i] <= Average)
            {
                Poors++;
            }
        }
        cout << Poors << "\n";
    }
}

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

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

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

void f(){
    int n, i;
    vector<int> counts(50000);
    int j = 0;
    while(1){
        cin >> n;
        if (n == 0){
            for(i = 0; i < j; i++)
                cout << counts[i] << '\n';
            break;
        }

        vector<int> a(n);
        int sum = 0;
        for(i = 0; i < n; i++){
            cin >> a[i];
            sum += a[i];
        }
        double ave = sum / n;

        // ask below average number
        for(i = 0; i < n; i++){
            if(a[i] <= ave){
                counts[j]++;
            }
        }
        j++;
    }
}

int main(){
    f();
    return 0;
}

C++: #include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define fore(i,a) for(auto &i:a)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)


using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 (b<a) { a = b; return 1; } return 0; }


int N, A[10101];
//---------------------------------------------------------------------------------------------------
void _main() {
	while (cin >> N) {
		if (N == 0) return;
		rep(i, 0, N) cin >> A[i];

		int min = 0;
		rep(i, 0, N) min += A[i];

		int answer = 0;
		rep(i, 0, N) if (A[i] * N <= min) answer++;
		printf("%d\n", answer);
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int n;
    while (true) {
        cin >> n;
        if (n == 0) break;

        vector<int> a(n);
        int sum = 0;
        rep(i, n) {
            cin >> a.at(i);
            sum += a.at(i);
        }
        int average = sum/n;
        int ans = 0;
        rep(i, n) {
            if (a.at(i) <= average) ans++;
        }

        cout << ans << endl;
    }
}

C++: #include <iostream>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
int a[10000];

int main() {
	int i;
	
	while (cin >> n) {
		if (!n) break;
		rep(i, n) cin >> a[i];
		
		double aveA = 0;
		rep(i, n) aveA += a[i];
		aveA /= n;
		
		int cnt = 0;
		rep(i, n) if (a[i] <= aveA) cnt++;
		cout << cnt << endl;
	}
	return 0;
}