import sys
sys.setrecursionlimit(4100000)
import numpy as np
n = int(input())
a = np.array([int(i) for i in input().split()])
f = np.zeros([n,n])
f[0] = np.cumsum(a)
dig = np.zeros([n,n])
for i,j in enumerate(a[:-1]):
    f[i+1] = f[i] - j
    dig += np.eye(n,n,-i-1)*np.e
f += dig
print(len(np.where(f == 0)[0]))