def main(N,A):
    B=[0]
    count = 0
    for i in range(N):
        T = A[i] + B[i]
        print(B)
        if T in B:

            print('count:',count)
            count += B.count(T)


    # B = [A[i] +B[i] for i in range(N)]
    #
    # count = [ count + 1 for m in range(len(B)) if B[i] - B[i-m] == 0]

        # for m in range(len(B)):
        #     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)