
in_arr1 = input()
in_arr2 = input().split()

N     = int(in_arr1)
arr_A = [int(in_arr2[i]) for i in range(N)]
leng  = len(arr_A)
count = 0

for i in range(leng):
  for j in range(leng-1-i):
    if(sum(arr_A[j:-1]) == 0):
      count += 1

# print("count = " + str(count))
print(count)
