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=1;
  while(n!=0){
    cin >> n;
    if(n!=0){
    int a[n];
    int ave=0; //平均値
    int low=0; //平均以下
    for(int i=0;i<n;i++){
      cin >> a[i];
      ave += a[i];
    }
    ave = ave/n;
    for(int i=0;i<n;i++){
      if(a[i]<=ave){
        low++;
      }
    }
    cout << low << endl;
  }
  }
  return 0;
}

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

int main() {
    for (;;) {
        int n, a[100000];
        int ave = 0;
        cin >> n;
        if (0 == n) {
            break;
        }
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
            ave += a[i];
        }
        ave /= n;
        int under = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] <= ave) {
                ++under;
            }
        }
        cout << under << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdlib>
#define LL long long

using namespace std;

const int maxn = 10000+7;
const double eps = 1e-6;

int n;
double sum,a[maxn];

int main()
{
    while (scanf("%d",&n))
    {
        if (n==0) break;
        sum=0;
        for (int i=0;i<n;i++) {scanf("%lf",&a[i]);sum=sum+a[i];}

        double ave=sum/n;
        int ans=0;
        for (int i=0;i<n;i++)
        {
            if (a[i]-ave<0 || abs(a[i]-ave)<eps) ans++;
        }

        printf("%d\n",ans);
    }
    return 0;
}

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

int main(void)
{
    int Members, Scores[10000], Total = 0, Average, Poors = 0, i;

    while(true)
    {
        cin >> Members;
        for(i = 0; i < Members; i++)
        {
            Scores[i] = 0;
            cin >> Scores[i];
            Total = Total + Scores[i];
        }
        Average = Total / Members;
        for(i = 0; i < Members; i++)
        {
            if(Scores[i] <= Average)
            {
                Poors++;
            }
        }
        cout << Poors << "\n";
    }
}

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

int main(){
  while(true){
    int n;
    cin>>n;
    if(n==0){
      break;
    }
    int x=0;
    int tmp[n];
    for(int i=0;i<n;i++){
      cin>>tmp[i];
      x=x+tmp[i];
    }
    int f=x/n;
    int p=0;
    for(int i=0;i<n;i++){
      if(tmp[i]<=f){
        p++;
      }
    }
    cout<<p<<endl;
  }
}

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

int n, a[10005];

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

  }
  
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

void solve(int n) {
    int a[n];
    int sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    double ave = (double)sum / n;
    sum = 0;
    rep(i, n) {
        if (a[i] <= ave) sum++;
    }
    cout << sum << endl;
}
int main() {
    int n;
    while (cin >> n && n) {
        solve(n);
    }
}

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

using namespace std;

int main(void) {
	vector<int> result(0);
	int n;
	cin >> n;
	while (n > 0) {
		vector<int> array(0);
		int sum = 0;
		for (int i = 0; i < n; i++) {
			int tmp;
			cin >> tmp;
			sum += tmp;
			array.push_back(tmp);
		}
		double avg = sum / n;
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (array[i] <= avg) {
				++count;
			}
		}
		result.push_back(count);
		cin >> n;
	}
	
	for (int &num:result) {
		cout << num << endl;
	}
	
	return 0;
}

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

int n,ans;
double ave;
vector<double> A;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> n,n){
        A.clear();
        ave=0;
        for (int i=0;i<n;++i){
            double a; cin >> a;
            ave+=a;
            A.emplace_back(a);
        }
        ave/=n; ans=0;
        for (int i=0;i<n;++i){
            if (A[i]<=ave) ++ans;
        }
        cout << ans << endl;
    }
}

C++: // #include "bits/stdc++.h"

#include <iostream>
#include <vector>
// #include <map>
// #include <string>
#include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

int main() {
	int n;
	while (1) {
		cin >> n;
		if (n == 0) {
			break;
		}
		int count = 0;
		vector<int> vec(n, 0);
		for (int i = 0; i < n; i++) {
			cin >> vec[i];
		}
		double mean = accumulate(vec.begin(), vec.end(), 0.0) / vec.size();
		sort(vec.begin(), vec.end());
		for (auto itr = vec.begin(); itr < vec.end(); itr++) {
			if (*itr <= mean) {
				count++;
			} else {
				break;
			}
		}
		cout << count << endl;
	}
	// std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n, a[100000], sum; //sumはn人の平均値の合計
    int num;  //numは平均値以下の所得者数
    
    while(true){
        cin >> n;
        if(n == 0) break;
        
        sum = 0;
        num = 0;

        for(int i = 0; i < n; i++){  
            cin >> a[i];
            sum += a[i];
        }
        int mean = sum / n;
        for(int i = 0; i < n; i++){
            if(a[i] <= mean) num++;
        }
        cout << num << endl;
    }
}