def main():
    import sys
    from itertools import accumulate

    n = int(input())
    a = list(map(int, sys.stdin.readline().split()))
    b = list(accumulate(a))

    ans = 0
    for i, x in enumerate(b):
        if x == 0: ans += 1
        for y in b[:i]:
            if x - y == 0:
                ans += 1
    print(ans)


if __name__ == '__main__':
    main()
