# coding: utf8


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    count = 0
    sub_sum = 0
    tmp_sum = 0
    for i in range(0, N):
        for j in range(i, N):
            tmp_sum += A[j]
            if sub_sum == tmp_sum:
                count += 1
        sub_sum += A[i]
        tmp_sum = sub_sum
    print(count)