import numpy as np
x = input()
N = np.array(list(map(int, input().split())))
M = np.copy(N)
ans = 0
length = len(N)
for i in range(length):
    ans += sum(map(lambda a: a == 0, N))
    M = M[1:]
    N = N[:-1] + M


print(ans)