import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


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

    cnt = 0
    for i in range(N):
        res = 0
        for j in range(i, N):
            res += A[j]
            if res == 0:
                cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()
