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>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define repb(i, n) for (int i = (int)n; i >= 0; i--)
#define reps(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define repsb(i, m, n) for (int i = (int)m; i >= (int)n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
#define ll long long int
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[])
{

    int n, ave, cnt;

    while (1)
    {
        ave = cnt = 0;
        cin >> n;
        if (n == 0)
            break;
        vector<int> v(n);
        rep(i, n)
        {
            cin >> v[i];
            ave += v[i];
        }
        ave /= n;
        rep(i, n)
        {
            if (v[i] <= ave)
            {
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

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


int main(){
    int n, a, b=0,sum=0, avr, c=0;
    vector<int> count(1000000);
    for(int j=0; j<1000000; j++){
        cin >> n;
        if(n==0) break;
        vector<int> s(n);
        for(int i=0; i<n; i++){
            cin >> s[i];
            sum += s[i];
        }
        avr = sum / n;
        for(int i=0; i<n; i++){
            if(s[i] <= avr) c += 1;
        }
        count[j]=c;
        sum=0;
        c=0;
        b+=1;
    }
    for(int i=0; i<b; i++){
        cout << count[i] << endl;
    }
}

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

int solve_testcase() {
  int N; cin >> N;
  if(N == 0) return 1;

  int 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] * N <= sum) ans++;
  }
  cout << ans << endl;
  
  return 0;
}

int main() {
  while(!solve_testcase());
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
while(cin>>n,n){
  double mon=0;
int k[n],ans=0;
for(int i=0;i<n;++i){cin>>k[i],mon+=k[i];}
mon/=n;
for(int i=0;i<n;++i){
  if(k[i]<=mon) ++ans;
}
cout<<ans<<endl;
}
}

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

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

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

        int c = 0;
        for (int i=0; i<n; ++i) {
            if (a[i] * n <= sum) {
                c ++;
            }
        }
        cout << c << endl;
    }
    return 0;
}

C++: #include "bits//stdc++.h"
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
ll a[10000];
int main() {
	int n;
	while (cin >> n, n) {
		ll 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 (a[i] * n <= sum) {
				ans++;
			}
		}
		cout << ans << endl;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

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

		VI a(n);
		rep(i, n)cin >> a[i];
		int ave = accumulate(all(a), 0) / n;
		SORT(a);
		auto it = upper_bound(all(a), ave);
		size_t pos = distance(a.begin(), it);

		cout << pos << endl;
	}
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    while (cin >> n && n) {
        long long a[n];
        long long sum = 0;
        int ans = 0;
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
            sum += a[i];
        }
        for (int i = 0; i < n; ++i) {
            if (a[i] * n <= sum) ++ans;
        }
        cout << ans << '\n';
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<int> a(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(a[i] * n <= sum)
                ++ ans;
        }
        cout << ans << endl;
    }
}