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 <vector>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define vi vector<int>
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

const int MOD = 1e9 + 7;
const int INF = 1 << 30;


class UnionFind{
private:
        vector<int> par,rank,sizes;
        int tree;

public:
        explicit UnionFind(const int n) : tree(n){
            par.resize(n+1);
            rank.resize(n+1);
            sizes.resize(n+1);
            rep(i,n){
                par[i] = i;
                sizes[i] = 1;
            }
        }

        ~UnionFind() = default;

        int root(int x){
            if(par[x] == x) return x;
            else return par[x] = root(par[x]);
        }

        int find(int x){ return root(x);}

        void unite(int x, int y) {
            x = root(x);
            y = root(y);
            if (x == y) return;

            if (rank[x] < rank[y]) swap(x, y);
            par[y] = x;
            tree--;
            sizes[x] += sizes[y];
            if (rank[x] == rank[y]) rank[x]++;
        }

        bool same(int x, int y){
            return root(x) == root(y);
        }

        int size(int x){
            return sizes[x];
        }

        int sumTree(){
            return tree;
        }
};

template <typename T>
class segmentTree{
private:
    int n;
    vector<T> arr;
public:

    explicit segmentTree(vector<T> v){
        ll sz = v.size();
        //while()

        arr.resize(2*n - 1);

    }

    T &operator[](int n){ return arr[n];}


};

template <int mod>
class ModInt{
private:
    ll _num;

public:
    ModInt(){_num = 0;}
    explicit ModInt(ll value){_num = value%mod;}

    ModInt operator+(ModInt &x){ return ModInt(_num + x._num);}
    ModInt operator-(ModInt &x){ return ModInt(_num - x._num);}
    ModInt operator*(ModInt &x){ return ModInt(_num * x._num);}
    friend ostream &operator<<(ostream &os, const ModInt &x){os<<x._num; return os;}
    friend istream &operator>>(istream &is, ModInt &x){is>>x._num; return is;}
};
using mint = ModInt<MOD>;


class topos{

};

int gcd(int a,int b){
    return b ? gcd(b,a%b) : a;
}

ll power(ll m, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = ((res%mod) * (m%mod))%mod;
        m = (m * m)%mod;
        n >>= 1;
    }
    return res;
}


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

        vi a(n);
        double ave = 0;

        rep(i,n){
            cin >> a[i];
            ave += a[i];
        }

        ave = ave / n;

        sort(a.begin(),a.end());

        rep(i,n){
            if(a[i] > ave){
                cout << i << endl;
                break;
            }

            if(i == n-1){
                cout << i+1 << endl;
            }
        }


    }

}

C++: #include "iostream"
#include "random"
#include "string"
#include "bitset"
#include "algorithm"
#include "map"
#include "queue"
#include "list"
#include "set"
#include "climits"
#include "iomanip"
#include "functional"
#include "stack"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, L, R, H, W;



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

	cin >> N;
	while (N) {
		vector<long long int>v(N);
		for (auto &i : v)cin >> i;
		K = 0;
		M = accumulate(v.begin(), v.end(), 0LL);
		for (auto i : v) {
			if (i*N <= M)K++;
		}
		cout << K << endl;
		cin >> N;
	}
}

C++: #include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int n,i,avg,sum,cnt,x[10000];
	while(1)	{
		scanf("%d",&n);
		if(n==0)	break;
		sum=0;
		for(i=0;i<n;i++)	{
			scanf("%d",&x[i]);
			sum+=x[i];
		}
		cnt=0;
		for(i=0;i<n;i++)	{
			if(x[i]*n<=sum)	cnt++;
		}
		printf("%d\n",cnt);
	}
	return 0;
}

C++: #include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<int>;


bool solve()
{
	int n; cin >> n;

	if (n == 0)return false;

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

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

	cout << ans << endl;

	return true;
}


int main()
{
	while (solve());

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  while(1){
    int n;
    cin>>n;
    if(!n)
      break;
    unsigned int sum=0;
    int tmp[n];
    for(int i=0;i<n;i++){
      cin>>tmp[i];
      sum+=tmp[i];
    }
    int ava=sum/n;
    int cnt=0;
    for(int i=0;i<n;i++){
      if(tmp[i]<=ava)
        cnt++;
    }
    cout<<cnt<<endl;
  }
  return 0;
}

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

int main(){
    while (1){
        int n;
        cin >> n;
        if (!n) break;
        vector<int> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];
        double avr = 0;
        for (int i = 0; i < n; i++) avr += a[i];
        avr /= n;
        int ans = 0;
        for (int i = 0; i < n; i++){
            if (a[i] <= avr) ans++;
        }
        cout << ans << endl;
    }
}

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

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

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

template <typename T>
int getFormer(const vector<T> &vec, T x) {
    return upper_bound(vec.begin(), vec.end(), x) - vec.begin() - 1;
}

template <typename T>
int getLatter(const vector<T> &vec, T x) {
    return lower_bound(vec.begin(), vec.end(), x) - vec.begin();
}

int solve(int N) {
    vector<double> a(N);
    REP(i, N) { cin >> a[i]; }
    double ave = accumulate(ALL(a), 0) / (double)N;
    int ans = 0;
    REP(i, N) {
        if (a[i] <= ave) {
            ans += 1;
        }
    }
    return ans;
}

int main() {
    int N;
    while (cin >> N && N) {
        cout << solve(N) << endl;
    }
}