def main(N,A):
    B=[0]
    count = 0
    for i in range(N):
        T = A[i] + B[i]
        for m in range(N+1):
            if T - B[m] == 0:
                # print(i, m)
                # print(B[i],B[i-m])
                # print(T)
                # print("kore",B[i],B[i-m])
                count += 1
        B.append(T)

    #print(count)
    #print(B)
    return print(count)

if __name__ == "__main__":
    N=int(input())
    A=list(map(int,input().split()))

    main(N,A)