def main(n, input_str):
    l = list(map(int, input_str.split(' ')))
    counter = 0
    for i in range(n):
        t_sum = 0
        for j in range(i, n):
            t_sum += l[j]
            if 0 == t_sum:
                counter += 1
                # break
    print(counter)
            


if __name__ == '__main__':
    try:
        n = int(input().strip())
        main(n, input().strip())
    except EOFError:
        pass
