inf = open("merlin.in", "r")
ouf = open("merlin.out", "w")

n = int(inf.readline())
a = list(map(int, inf.readline().split()))

prefsum = [0] * (n + 1)
prefmax = [0] * (n + 1)
for i in range(n):
    prefsum[i + 1] = prefsum[i] + a[i]
    prefmax[i + 1] = max(prefmax[i], a[i])

v = 0
ans = 0
for i in range(n - 1, -1, -1):
    if prefmax[i + 1] * (i + 1) - prefsum[i + 1] <= v:
        ans = n - i - 1
        break
    v += a[i]

print(ans, file = ouf)

inf.close()
ouf.close()

