N = int(input())
num_list = [int(a) for a in input().split()]
num_list2 = [sum(num_list[i:]) for i in range(len(num_list))]
num_list3 = [num_list2.count(a)-1 for a in num_list2]
ans = str(sum(num_list3) // 2 + num_list2.count(0))
print(ans)