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 <bits/stdc++.h>
#include <assert.h>

using namespace std;

int main()
{
  while (true)
  {
    int n;
    cin >> n;
    if (n == 0)
      break;
    long long 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] <= sum / n)
        ans++;
    cout << ans << endl;
  }

  return 0;
}

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

int solve(int N) {
    vector<int> A(N);
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    sort(A.begin(), A.end());
    auto Itere = upper_bound(A.begin(), A.end(), sum / N);
    return Itere - A.begin();
}

int main() {
    int N;
    vector<int> ans;
    while (cin >> N) {
        if (!N) break;
        ans.push_back(solve(N));
    }

    for (int i : ans) cout << i << endl;
}

C++: #include <iostream>
#include <cmath>
#include <utility>
#include <functional>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

int main() {
	int n;
	cin >> n;

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

		int sum = 0;
		rep(i,0,n) sum += income[i];
		int ave = sum / n, ans = 0;

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

		cout << ans << endl;

		cin >> n;
	}

	return 0;
}

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

int main()
{
    vector<int> ans;
    while (1)
    {
        int n;
        cin >> n;
        if (n == 0)
        {
            break;
        }

        vector<int> inputList;
        int sum = 0;

        for (int i = 0; i < n; i++)
        {
            int a;
            cin >> a;
            inputList.push_back(a);
            sum += a;
        }

        int ave = sum / n;
        int num = 0;

        for (int i = 0; i < n; i++)
        {
            if (inputList[i] <= ave)
            {
                num++;
            }
        }

        ans.push_back(num);
    }

    for (int i = 0; i < ans.size(); i++)
    {
        cout << ans[i] << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

int main()
{
    while (cin >> N)
    {
        if (N == 0)
            return 0;
        vector<int> a(N);
        int sum = 0, ans = 0;
        for (int i = 0; i < N; i++)
        {
            cin >> a[i];
            sum += a[i];
        }
        sum /= N;
        for (int i = 0; i < N; i++)
        {
            if (a[i] <= sum)
                ans++;
        }
        cout << ans << endl;
    }
}

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

int N,A[10010];
int main(){
	while(cin>>N && N>0){
		int sum = 0;
		for(int i=1;i<=N;i++){
			cin >> A[i];
			sum += A[i];
		}
		int ans = 0;
		for(int i=1;i<=N;i++){
			if(A[i]*N<=sum) ans++;
		}
		cout << ans << endl;
	}
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn = 1e4 + 5;
int n, a[maxn];

int main() {
	while (scanf("%d", &n) && n != 0) {
		int sum = 0, num = 0;
		for (int i = 0; i < n; i++) {
			scanf("%d", &a[i]);
			sum += a[i];
		}
		sum /= n;
		for (int i = 0; i < n; i++) {
			if (a[i] <= sum)num++;
		}
		printf("%d\n", num);
	}
	return 0;
}

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;
        }
        for(i = 0; i < Members; i++)
        {
            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>
using namespace std;

int main(){
    int n;
    int a[10000];
    int count=0;
    int sum=0;
    while(true){
        cin >>n;
        if(n==0)
        break;
        for(int i=0;i<n;i++){
            cin >> a[i];
            sum+=a[i];
        }
        for(int i=0;i<n;i++){
            if(a[i]<=sum/n)
            count++;
        }
        cout << count << endl;
        count=0;
        sum=0;
    }
    return 0;
}

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

void f(){
    int n, i;
    vector<int> counts(50000);
    int j = 0;
    while(1){
        cin >> n;
        if (n == 0){
            for(i = 0; i < j; i++)
                cout << counts[i] << '\n';
            break;
        }

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

        // ask below average number
        for(i = 0; i < n; i++){
            if(a[i] <= ave){
                counts[j]++;
            }
        }
        j++;
    }
}

int main(){
    f();
    return 0;
}