

def main(N,A):
    B=[0]

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

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




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