N = int(input())
num_list = list(map(int, input().split()))

cnt = 0
for idx1, i in enumerate(num_list):
    s = num_list[idx1]
    for idx2, j in enumerate(num_list, idx1 + 1):
        if idx2 >= len(num_list):
            break
        s += num_list[idx2]
        if s == 0:
            cnt += 1
            s = 0
print(cnt)
