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 <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>

int main()
{
    int n;
    while(scanf("%d",&n)==1){
        if(n==0){
            break;
        }
        else{
            double a[100000];
            for(int i=0;i<n;i++){
            scanf("%lf",&a[i]);
            }
            double sum = 0;
            for(int i=0;i<n;i++){
                sum += a[i];
            }
            double h = sum/n;
            int count = 0;
            for(int i=0;i<n;i++){
                if(a[i]<=h){
              count++;
                }
            }
            printf("%d\n",count);

        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, s, n) for (int i = s; i < n; i++)
#define erep(e, v) for (auto &&e : v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int) 1e9 : (int) 1e18)
#define EPS 0.0000000001
using namespace std;
template <class T, class S> void cmin(T &a, const S &b) {
    if (a > b) a = b;
}
template <class T, class S> void cmax(T &a, const S &b) {
    if (a < b) a = b;
}
template <typename Head, typename Value>
auto vectors(const Head &head, const Value &v) {
    return vector<Value>(head, v);
}
template <typename Head, typename... Tail> auto vectors(Head x, Tail... tail) {
    auto inner = vectors(tail...);
    return vector<decltype(inner)>(x, inner);
}
template <class T, class S> void join(T &a, S terminator) {
    for (auto itr = begin(a); itr != end(a); itr++) {
        if (itr != begin(a)) cout << terminator;
        cout << *itr;
    }
    cout << endl;
}
int W, H;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
bool valid(int x, int y) { return (0 <= x && x < W) && (0 <= y && y < H); }
auto out(int a, int b) {
    (a > b ? a += 1 : b += 1);
    cout << a << " " << b << endl;
}
main() {
    int n, m;
    while (cin >> n, n) {
        vector<double> v(n);
        erep(e, v) cin >> e;
        sort(all(v));
        double avg = accumulate(all(v), 0.0) / n;
        auto itr   = upper_bound(all(v), avg);
        cout << (itr == v.end() ? n : itr - v.begin()) << endl;
    }
}

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

using namespace std;
int main(){
    int n;
    while(cin>>n){
        if(n==0)break;
        vector<int> v(n);
        int ave=0;
        for(int i=0;i<n;i++){
            cin>>v[i];
            ave+=v[i];
        }
        ave/=n;
        int ans=0;
        for(int i=0;i<n;i++){
            if(ave>=v[i])ans++;
        }
        cout<<ans<<endl;
    }
}

C++: #include <bits/stdc++.h>
#define ll long long
#define INF 1000000000
using namespace std;
int main(){
    int N,sum;
    while(1){
        sum = 0;
        cin >> N;
        if(N==0) return 0;
        int A[N];
        for(int i=0;i<N;i++){
            cin >> A[i];
            sum += A[i];
        }
        double ave = (double)sum/N;
        int ans = 0;
        for(int i=0;i<N;i++){
            if(A[i]<=ave) ans++;
        }
        cout << ans << endl;
    }
}

C++: //QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
using namespace std;

const int maxn=10000+10;
int a[maxn];

typedef long long ll;

int main()
{
	int n;
	while(scanf("%d",&n) && n)
	{
		ll sum=0;
		rep(i,1,n) scanf("%d",a+i),sum+=a[i];
		sort(a+1,a+n+1);
		
		int ans=0;
		rep(i,1,n) if(1ll*a[i]*n <= sum) ++ans;
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    vector<int> a(n);
    double me = 0;
    for(int i=0;i<n;++i) {
      cin >> a[i];
      me += a[i];
    }
    me /= n;
    me += eps;
    int cnt = 0;
    for(int i=0;i<n;++i) {
      if(a[i] <= me) {
        cnt++;
      }
    }
    cout << cnt << endl;
  }
}

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

int main() {
	while (true) {
	int n;
	std::cin >> n;
	if (n == 0) break;
	std::vector<int> a(n);
	int sum = 0;
	for(auto& v : a) {
		std::cin>>v;
		sum += v;
	}

	int ans = 0;
	for(auto v : a) {
		if (v * n <= sum) ++ans;
	}

	std::cout << ans << std::endl;
}
	return 0;

}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#define INF (long)1e9
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
using namespace std;
typedef long long ll;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	while(cin >> n, n)
	{
		int A[n + 1];
		int sum = 0;
		for(int i = 0; i < n; i++)
		{
			cin >> A[i];
			sum += A[i];
		}
		int avg = sum / n;
		sort(A, A + n);
		int cnt = 0;
		for(int i = 0; i < n; i++)
		{
			if(A[i] <= avg)
				cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#define ll long long
using namespace std;
const int maxn=1e5+10;

int a[maxn], b[maxn], c[maxn];
string s;

int main() {
    //freopen("a.out", "w", stdout);
    ll n;
    while(cin >> n && n) {
        int sum=0;
        for(int i=1;i<=n;++i) cin>>a[i],sum+=a[i];
        sum/=n;
        int res=0;
        for(int i=1;i<=n;++i) if(a[i]<=sum) res++;
        cout<<res<<'\n';
    }
}


/*
100 1100101


*/