import numpy as np
import itertools
N = int(input().strip())
A = list(map(int,input().strip().split(' ')))
Z = np.zeros((N+1,N))
Z[0,:] = np.array(A)
result = 0

for i,j in itertools.combinations_with_replacement(range(1,N),2):
        tmp = Z[i-1,j-1]+Z[0,j]
        if tmp ==0:
                result = result+1
        Z[i,j] = tmp
print(result)