import sys
n=int(input())
l=sorted(list(map(int,input().split())))
mn=sum(l)/len(l)
for i in range(len(l)):
    if l[i]==mn:
        print(i)
        sys.exit()
else:
    if abs(mn-l[i//2-1])<abs(mn-l[i//2]):
        print(i//2-1)
        sys.exit()
    else:
        print(i//2)
        sys.exit()