import numpy as np


N = int(input())
A = list(map(int, input().split()))
count = 0
num_list = []
A_list = []


if N == 1:
    if A[0] == 0:
        count += 1
    print(count)
else:
    num = A[0]
    num_list.append(A[0])
    for i in A[1:]:
        num += i
        num_list.append(num)
    A2 = np.array(num_list)
    A_list += list(A2)
    for n, i in enumerate(A):
        A2 = A2 - i
        A2 = A2[1:]
        if len(A) - 1 != n:
            A_list += list(A2)
    print(A_list.count(0))