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 <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int> > minpq;

int main() {
    while (true){
        int n;
        cin >> n;
        if (n == 0) break;
        ll ans = 0;
        vector<ll>a(n);
        for(int i=0; i<n;i++){
            cin>>a.at(i);
        }
        for(int i=0;i<n;i++){
            ans+=a.at(i);
        }
        ll cnt=0;
        for(int i=0;i<n;i++){
            if (a.at(i)*n<=ans){
                cnt++;
            }
        }
        cout << cnt << '\n';
    }
    return 0;
}

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

using namespace std;

int main(void) {
	int n;
	while (cin >> n,n) {
		int sum = 0;
		vector<int> data(n);
		for (int i = 0; i < n; ++i) {
			cin >> data[i];
			sum += data[i];
		}
		sort(data.begin(),data.end());
		int res = 0;
		double ave = (double)sum/n;
		for (int i = 0; data[i] <= ave && i < n; ++i) {
			++res;
		}
		cout << res << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repb(i, n) for (int i = (int)n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define repsb(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
#define ll long long int
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[])
{

    int n, ave, cnt;

    while (1)
    {
        ave = cnt = 0;
        cin >> n;
        if (n == 0)
            break;
        vector<int> v(n);
        rep(i, n)
        {
            cin >> v[i];
            ave += v[i];
        }
        ave /= n;
        rep(i, n)
        {
            if (v[i] <= ave)
            {
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

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


int main(){
    int n, a, b=0,sum=0, avr, c=0;
    vector<int> count(1000000);
    for(int j=0; j<1000000; j++){
        cin >> n;
        if(n==0) break;
        vector<int> s(n);
        for(int i=0; i<n; i++){
            cin >> s[i];
            sum += s[i];
        }
        avr = sum / n;
        for(int i=0; i<n; i++){
            if(s[i] <= avr) c += 1;
        }
        count[j]=c;
        sum=0;
        c=0;
        b+=1;
    }
    for(int i=0; i<b; i++){
        cout << count[i] << endl;
    }
}

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

int solve_testcase() {
  int N; cin >> N;
  if(N == 0) return 1;

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

int main() {
  while(!solve_testcase());
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
while(cin>>n,n){
  double mon=0;
int k[n],ans=0;
for(int i=0;i<n;++i){cin>>k[i],mon+=k[i];}
mon/=n;
for(int i=0;i<n;++i){
  if(k[i]<=mon) ++ans;
}
cout<<ans<<endl;
}
}

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

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

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

        int c = 0;
        for (int i=0; i<n; ++i) {
            if (a[i] * n <= sum) {
                c ++;
            }
        }
        cout << c << endl;
    }
    return 0;
}

C++: #include "bits//stdc++.h"
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
ll a[10000];
int main() {
	int n;
	while (cin >> n, n) {
		ll 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 (a[i] * n <= sum) {
				ans++;
			}
		}
		cout << ans << endl;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

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

		VI a(n);
		rep(i, n)cin >> a[i];
		int ave = accumulate(all(a), 0) / n;
		SORT(a);
		auto it = upper_bound(all(a), ave);
		size_t pos = distance(a.begin(), it);

		cout << pos << endl;
	}
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    while (cin >> n && n) {
        long long a[n];
        long long sum = 0;
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
            sum += a[i];
        }
        for (int i = 0; i < n; ++i) {
            if (a[i] * n <= sum) ++ans;
        }
        cout << ans << '\n';
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        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(a[i] * n <= sum)
                ++ ans;
        }
        cout << ans << endl;
    }
}