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 all(x) (x).begin(),(x).end()
#define fore(i,a) for(auto &i:a)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)


using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }


int N, A[10101];
//---------------------------------------------------------------------------------------------------
void _main() {
	while (cin >> N) {
		if (N == 0) return;
		rep(i, 0, N) cin >> A[i];

		int min = 0;
		rep(i, 0, N) min += A[i];

		int answer = 0;
		rep(i, 0, N) if (A[i] * N <= min) answer++;
		printf("%d\n", answer);
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

        vector<int> a(n);
        int sum = 0;
        rep(i, n) {
            cin >> a.at(i);
            sum += a.at(i);
        }
        int average = sum/n;
        int ans = 0;
        rep(i, n) {
            if (a.at(i) <= average) ans++;
        }

        cout << ans << endl;
    }
}

C++: #include <iostream>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
int a[10000];

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

C++: #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};

void solve(){
  while(true){
    int N; cin >> N;
    if(N == 0) break;
    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;
  }
}

int main(void){
    cin.tie(0);
   	ios::sync_with_stdio(false);

    solve();
}

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

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

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

int main(){
    int n;
    while(cin >> n, n){
        vector<int> a(n);
        int ave = 0;
        for(int i = 0 ; i < n ; ++i){
            cin >> a[i];
            ave += a[i];
        }
        ave /= n;
        int ans = 0;
        for(int i = 0 ; i < n ; ++i){
            ans += a[i] <= ave;
        }

        cout << ans << endl;
    }
}

C++: #include <cstdio>
#include <algorithm>
using namespace std;
int p[10001];

int main()
{
    int n, sum, avg;
    for (;; ){
        scanf("%d", &n);
        if (n == 0) break;
        sum = 0;
        for (int i = 0; i < n; i++) { scanf("%d", &p[i]); sum+= p[i]; }
        avg = sum / n;
        sort(p, p+n);
        int left = int(upper_bound(p, p+n, avg)-p);
        printf("%d\n", left);
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
bool solve() {
    int N;
    cin >> N;
    if(!N) return false;
 
    vector<int> A(N);
    int sum = 0;
    for(int &e : A) {
        cin >> e;
        sum += e;
    }
 
    int ans = 0;
    for(int i = 0; i < N; i++) if(N * A[i] <= sum) ans++;
    cout << ans << endl;
    return true;
}
 
int main() {
    while(solve());
    return 0;
}