Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n := io.NextInt()
		if n == 0 {
			break
		}
		a := make([]int, n)
		sum := 0
		for i := 0; i < n; i++ {
			a[i] = io.NextInt()
			sum += a[i]
		}
		cnt := 0
		for i := 0; i < n; i++ {
			if a[i] <= sum/n {
				cnt++
			}
		}
		io.Println(cnt)
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

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

int main()
{
	int N[10000];
	while(1){
		cin >> N[0];
		if(N[0]==0)break;
		int sum = 0;
		for(int i=1;i<=N[0];i++){
			cin >> N[i];
			sum+=N[i];
		}
		int avr = sum / N[0];
		int cnt = 0;
		for(int i=1;i<=N[0];i++)
			if(N[i]<=avr)cnt++;
		cout << cnt << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(void){

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

  vector<int>  a(n);  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((double)a[i] <= ave)   ans++;

  cout << ans << endl;
}

  return 0;
}

C++: #include<string>
#include<iostream>
int getlessAve(int num)
{
	std::string income_s, income;
	unsigned int ave = 0;
	int peopleN = 0, i, income_i[num];
	std::getline(std::cin, income_s);
	for(i = 0;i < num;i++)
	{
		income = income_s.substr(0, income_s.find_first_of(" "));
		income_s = income_s.substr(income_s.find_first_of(" ")+1, income_s.size());
		income_i[i] = std::stoi(income);
		ave += income_i[i];
	}
	ave /= num;
	for(i = 0;i < num;i++)
	{
		peopleN += ((unsigned int)income_i[i] <= ave?1:0);
	}
	return peopleN;
}

int main()
{
	std::string num;
	int p[50000], i = 0, count = 0;
	while(1)
	{
		std::getline(std::cin, num);
		if(std::stoi(num) == 0)
			break;
		p[count] = getlessAve(std::stoi(num));
		count++;
	}
	for(i = 0;i < count;i++)
		std::cout << p[i] << std::endl;
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <stdlib.h> //for exit
#include <algorithm> //for sort...etc
#include <numeric> //for accumulate
using namespace std;

int main()
{
    while(1)
        {
            int n,n_sum=0;
            vector<int> income;
            cin >> n; // mは制限値
            if(n == 0) exit(0); //END STATE
            for(int i = 0 ; i < n; i++) //INPUT
            {
                int tpprice;
                cin >> tpprice;
                income.push_back(tpprice);
            }

            for(int i = 0; i < n; i++)
            {
                int target = accumulate(income.begin(),income.end(),0)/n;
                if(income[i] <= target)
                {
                    n_sum++;
                }
            }

            cout << n_sum << endl;  
        }
}

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 <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()

using namespace std;
main(){
    while(1){
        ll n;cin>>n;
        if(!n)break;
        vector<ll> a(n);
        rep(i,n)cin>>a[i];
        ll sum = accumulate(all(a),0LL);
        int cnt = 0;
        rep(i,n){
            cnt += (a[i]*n <= sum);
        }
        cout << cnt <<endl;
    }
}

C++: #include<stdio.h>
int main() {
	while (1) {
		int n, j,k, a[10000], sum = 0, m = 0;
		scanf("%d", &n);
		if (n == 0)
			break;
		for (j = 1; j <=n; j++) {
			scanf("%d", &a[j]);
			sum += a[j];
		}
		for (j = 1; j <=n; j++) {
			if (a[j] <= sum / n)
				m++;
		}
		printf("%d\n", m);
	}
	return 0;
}

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

int main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n;
  cin>>n;
  int a[n];
  double average=0;
  for (int i=0; i<n; i++) {
    cin>>a[i];
    average+=a[i];
  }
  average/=n;
  int ans=0;
  for (int i=0; i<n; i++) {
    if (a[i]<=average) {
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){
    int n;
    long a[10002];
    long long suma;

    while(true){
        cin >> n;
        suma = 0;
        if(n == 0) break;
        for(int i=0;i<n;i++){
            cin >> a[i];
            suma += a[i];
        }
        double average = (double)suma / (double)n;
        int count = 0;
        for(int i=0;i<n;i++){
            if(a[i] <= average) count++;
        }

        cout << count << "\n";
    }

    return 0;
}

C++: #include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin>>n,n){
    vi A(n);
    ll sum=0;
    ll ans=0;
    for(auto &a:A){cin>>a;sum+=a;}
    for(int i=0;i<n;i++){
      ans+=(sum>=(A[i]*n));
    }
    cout<<ans<<endl;
  }
  return 0;
}

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