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>
using namespace std;

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

    int n;
    while(cin >> n){
        if(n == 0) break;
        vector<int> A(n);
        int total = 0;
        for(int i = 0; i < n; i++){
            cin >> A[i];
            total += A[i];
        }
        sort(A.begin(), A.end());
        int average = total / n;
        int cnt = 0;
        for(int i = 0; i < n; i++){
            if(A[i] <= average) cnt++;
            else break;
        }
        cout << cnt << endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
void f(int n){
    // Your code here!
    ll s[n];
    ll tot=0;
    for(int i=0;i<n;i++){
        cin>>s[i];
        tot+=s[i];
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(tot/n>=s[i])ans++;
    }
    cout<<ans<<endl;
}
int main(void){
    while(true){
        int N;
        cin>>N;
        if(N==0)break;
        f(N);
    }
    return 0;
}

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

using ll = long long;

ll SumFrom1ToN(ll n)
{
    return (1 + n) * n / 2;
}

int main()
{
    using namespace std;

    while (true)
    {
        int n;
        cin >> n;

        if (n == 0)
            break;

        vector<ll> a(n);
        for (auto& e : a)
            cin >> e;

        auto sum = accumulate(a.cbegin(), a.cend(), 0ll);
        auto mean = sum / n;
        auto c = count_if(a.cbegin(), a.cend(), [mean](auto x){return x <= mean;});

        cout << c << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int n;
    while (1) {
        cin >> n;
        if (n == 0) return 0;
        i64 sum = 0;
        vi as;
        for (int i = 0; i < n; i++) {
            int a;
            cin >> a;
            as.push_back(a);
            sum += a;
        }
        int cnt = 0;
        for (int a: as) {
            if (a <= sum / n) cnt++;
        }
        cout << cnt << endl;
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

C++: #include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while (cin >> n, n) {
		vl v(n);
		ll sum = 0;
		REP(i, n) {
			cin >> v[i];
			sum += v[i];
		}
		int cnt = 0;
		REP(i, n) {
			if (v[i] * n <= sum)cnt++;
		}
		cout << cnt << 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++: #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;


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

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

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

        int s = 0;
        rep(i,n) s += a[i];

        int ans = 0;
        rep(i,n) ans += (a[i]*n <= s);
        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<int> a(n);
        int sum = 0;
        for(int i = 0 ; i < n ; i++){
            cin >> a[i];
            sum += a[i];
        }
        int ave = sum / n, ans = 0;
        for(int i = 0 ; i < n ; i++){
            if(a[i] <= ave){
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

 #define int long long
 using namespace std;

int a[100020];
void solve(){
	int n;
	cin>>n;
//	cout<<" "<<n<<endl;
	int sum=0;
	if(n==0) exit(0);
	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;
}

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

 
    	
    	for(int i=0;;i++){
    		solve();
    	
    	}
    	return 0;
    	
            }

C++: #include <bits/stdc++.h>
#define LL long long
using namespace std;
int a[10005];
int main()
{
    int n,i,j,k,all;
    scanf("%d",&n);
    while(n!=0)
    {
        all=k=0;
        for(i=1;i<=n;i++)
        {
            a[i]=0;
            scanf("%d",&a[i]);
            all+=a[i];
        }
        all=all/n;
        for(i=1;i<=n;i++)
        {
            if(a[i]<=all)
                k++;
        }
        printf("%d\n",k);
        scanf("%d",&n);
    }
    return 0;
}