def main():
    N = int(input())
    A = list(map(int, input().split()))
    count = 0
    for i in range(0, N):
        b = 0
        for j in range(i, N):
            if j==i:
                b = A[i]
            else:
                b = b + A[j]
            if b == 0:
                count += 1
    return count

if __name__ == '__main__':
    print(main())

