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>
using namespace std;
typedef long long ll;
int main() {
  ll n = -1;
  while (n != 0) {
    ll sum = 0;
    cin >> n;
    if (n == 0)
      return 0;
    vector<ll> a;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      a.push_back(x);
      sum += x;
    }
    double mean = sum * 1.0 / n;
    int cnt = 0;
    for (int i = 0; i < n; i++)
      if (a[i] <= mean)
        cnt++;
    cout << cnt << endl;
  }
}

C++: #include <stdio.h>
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

int main()	{

	int n, temp, mean, count, res;
	vector<int> a;

	while (true)	{

		scanf("%d", &n);
		if (n == 0)	break;

		count = 0;

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

		mean = accumulate(a.begin(), a.end(), 0) / n;
		///
		//printf("mean::%d\n", mean);
		///
		sort(a.begin(), a.end());

		for (int i = 0; i < n; i++)	{
			if (a[i] <= mean)	{
				count++;
			} else	{
				break;
			}
		}

		printf("%d\n", count);

		a.clear();
	}

	return 0;
}

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 <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int n, m;
vector<int> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<ll>ans; 
    while(true){
        cin>>n;
        if(n==0)break;
        vector<ll> a(n);
        double sum=0;
        rep(i,n){
            cin>>a[i];
            sum+=a[i];
        }
        sum=sum/n;
        ll count=0;
        rep(i,n){
            if(a[i]<=sum){
                count++;
            }
        }
        ans.push_back(count);
    }
    rep(i,ans.size()){
        cout<<ans[i]<<"\n";
    }
}

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

int main(){
  while(1){
    int n,s;
    int a[10000];
    int cnt=0,t=0;
    cin>>n;
    if(n==0){
      break;
    }
    for(int i=0;i<n;i++){
      cin>>a[i];
      t=t+a[i];
    }
    s=t/n;
    for(int i=0;i<n;i++){
      if(s>=a[i]){
        cnt++;
      }
    }
    cout<<cnt<<endl;
  }
}

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

int main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  while (true) {
    int n;
    cin>>n;
    if (!n) {
      break;
    }
    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<iostream>
#include<vector>
#include<numeric>
using namespace std;
int main(){
    while(true){
        int N;
        cin>>N;
        if(N==0)break;
        vector<int> a(N);
        for(int i =0;i<N;i++){
            cin>>a[i];
        }
        int ave = accumulate(a.begin(),a.end(),0)/a.size();
        int 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 rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define be(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

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

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,a[10005],sum;
#define rep(i,n) for(int i=0;i<n;i++)

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