def slv(A):
    S = [A[0]]
    for i in range(1, len(A)):
        S.append(S[i - 1] + A[i])
    S.append(0)

    return len(S) - len(set(S))


def main():
    N = int(input())
    A = list(map(int, input().split()))

    # import random
    # N = 2 * 100000
    # A = [random.randint(-1000000000, 1000000000) for _ in range(N)]

    print(slv(A))


if __name__ == '__main__':
    main()