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;
 
double a[500000];
 
int main() {
         int n;
         double mean;
          int ans;
         while(true) {
                 cin >> n;
                 if (n == 0) break;
 
                 for(int i = 0;i < n;i++) cin >> a[i];
 
                 mean = 0;
                 ans = 0;
 
                 for(int i = 0;i < n;i++) mean += a[i];
 
                 mean /= n;
 
                 for(int i = 0;i < n;i++) {
                         if (a[i] <= mean) ans += 1;
                 }
 
                 cout << ans<< "\n";
         }
 }

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

int main()
{
    int n;

    while( cin >> n )
    {
        if( n == 0 )
            break;
        int a[n];

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

        double ave = sum / n;
        int cnt = 0;
        for( int i = 0; i < n; i++ )
            if( a[i] <= ave )
                cnt++;

        cout << cnt << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    
    for(ll n; cin >> n, n; ){
        vector<ll>vec(n);
        ll sum = 0;
        for(ll i = 0; i < n; i++){
            cin >> vec[i];
            sum += vec[i];
        }
        ll ans = 0;
        for(ll i = 0; i < n; i++){
            if(vec[i] * n <= sum)ans++;
        }
        cout << ans << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    while(true){
        int N; cin >> N;
        if(N==0) break;
        int A[N];
        int sum=0;
        rep(i,N) {cin >> A[i]; sum+=A[i];}
        int ave=sum/N;
        int cnt=0;
        rep(i,N){
            if(A[i]<=ave) cnt++;
        }
        cout << cnt << "\n";
    }
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int main(){
  int n;
  cin >> n;

  while(n != 0){
      vector<int> num;
      REP(i,n){
          int t;
          cin >> t;
          num.pb(t);
        }

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

         int ans = 0, sum = 0;
        REP(i,n){
          sum += num[i];
          }
          sum /= n;

          REP(i, n){
              if(num[i] <= sum) ans++;
            }
            cout << ans << endl;

            cin >> n;
    }
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

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

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

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

    cout << ans << endl;


    return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>

using namespace std;

int main()
{
	int n;
	while(true)
	{
		cin >> n;
		if(n==0)break;
		vector<int> a(n);
		long long sum=0;
		for(int i=0;i<n;i++)
		{
			cin >> a[i];
			sum+=a[i];
		}
		double ave=sum/n;

		int ans=0;
		for(int i=0;i<n;i++)
		{
			if(a[i]<=ave)
				ans++;
		}
		cout << ans << endl;
	}




}

C++: #include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <fstream>
#include <cmath>
const int mod=1e9+7;
using LL=long long;
using std::cout;using std::endl;using std::cin;
using std::vector;using std::string;using std::set;using std::multiset;
using std::pair;using std::map;
using std::min;using std::max;
using std::make_pair;using std::swap;
std::ostream& operator<<(std::ostream& os,std::map<int,int>& obj){for(std::map<int,int>::iterator itr=obj.begin();itr!=obj.end();itr++){os<<itr->first<<"^"<<itr->second<<" ";}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<std::map<int,int>>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<std::endl;}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<int>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<" ";}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<std::vector<int>>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<std::endl;}return os;}

namespace ndifix{
template<class T> void sort(T &v){std::sort(v.begin(),v.end());}
template<class T> void rsort(T &v){std::sort(v.rbegin(),v.rend());}

}


int main(){
  int n;
  while(cin>>n){
    if(n==0)return 0;
    vector<int> a(n);for(int i=0;i<n;i++)cin>>a[i];
    ndifix::sort(a);
    int sum=0;for(int i=0;i<n;i++)sum+=a[i];
    int ans=0;for(int i=0;i<n;i++)if(a[i]*n<=sum)ans++;else break;
    cout<<ans<<endl;
  }
  return 0;
}