human
I found an interesting problem on https://codeforces.com/problemset/problem/1426/D:
Kolya got an integer array $a_1, a_2, \dots, a_n$. The array can contain both positive and negative integers, but Kolya doesn't like $0$, so the array doesn't contain any zeros.

Kolya doesn't like that the sum of some subsegments of his array can be $0$. The subsegment is some consecutive segment of elements of the array. 

You have to help Kolya and change his array in such a way that it doesn't contain any subsegments with the sum $0$. To reach this goal, you can insert any integers between any pair of adjacent elements of the array (integers can be really any: positive, negative, $0$, any by absolute value, even such a huge that they can't be represented in most standard programming languages).

Your task is to find the minimum number of integers you have to insert into Kolya's array in such a way that the resulting array doesn't contain any subsegments with the sum $0$.

-----Input-----

The first line of the input contains one integer $n$ ($2 \le n \le 200\,000$) — the number of elements in Kolya's array.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($-10^{9} \le a_i \le 10^{9}, a_i \neq 0$) — the description of Kolya's array.

-----Output-----

Print the minimum number of integers you have to insert into Kolya's array in such a way that the resulting array doesn't contain any subsegments with the sum $0$.

-----Examples-----
Input
4
1 -5 3 2

Output
1

Input
5
4 -2 3 -9 2

Output
0

Input
9
-1 1 -1 1 -1 1 1 -1 -1

Output
6

Input
8
16 -5 -11 -15 10 5 4 -4

Output
3


-----Note-----

Consider the first example. There is only one subsegment with the sum $0$. It starts in the second element and ends in the fourth element. It's enough to insert one element so the array doesn't contain any subsegments with the sum equal to zero. For example, it is possible to insert the integer $1$ between second and third elements of the array.

There are no subsegments having sum $0$ in the second example so you don't need to do anything.

I tried it in Python, but could not do it. Can you solve it?

=====
What is a Python program to find the minimum number of integers you have to insert into Kolya's array in such a way that the resulting array doesn't contain any subsegments with the sum $0$?
assistant
#Here is Python program to find the minimum number of integers you have to insert into Kolya's array in such a way that the resulting array doesn't contain any subsegments with the sum $0$.

from bisect import *
from collections import *
from math import *
from heapq import *
from typing import List
from itertools import *
from operator import *
from functools import *
import sys
'''
@lru_cache(None)
def fact(x):
    if x<2:
        return 1
    return fact(x-1)*x

@lru_cache(None)
def per(i,j):
    return fact(i)//fact(i-j)

@lru_cache(None)
def com(i,j):
    return per(i,j)//fact(j)

def linc(f,t,l,r):
    while l<r:
        mid=(l+r)//2
        if t>f(mid):
            l=mid+1
        else:
            r=mid
    return l

def rinc(f,t,l,r):
    while l<r:
        mid=(l+r+1)//2
        if t<f(mid):
            r=mid-1
        else:
            l=mid
    return l

def ldec(f,t,l,r):
    while l<r:
        mid=(l+r)//2
        if t<f(mid):
            l=mid+1
        else:
            r=mid
    return l

def rdec(f,t,l,r):
    while l<r:
        mid=(l+r+1)//2
        if t>f(mid):
            r=mid-1
        else:
            l=mid
    return l

def isprime(n):
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            return False
    return True

def power2(n):
    while not n&1:
        n>>=1
    return n==1
'''
'''
for i in range(t):
    #n,m=map(int,input().split())
    n,m=1,0
    graph=defaultdict(set)
    for i in range(m):
        u,v=map(int,input().split())
        graph[u-1].add(v-1)
    visited=[0]*n
    ans=[]
    def delchild(u):
        for child in graph[u]:
            visited[child]=1
            ans.append(child+1)
    for i in range(n):
        if not visited[i]:
            children=graph[i]
            if len(children)==1:
                u=children.pop()
                visited[u]=1
                delchild(u)
            elif len(children)==2:
                u=children.pop()
                v=children.pop()
                if u in graph[v]:
                    delchild(v)
                    visited[v]=1
                elif v in graph[u]:
                    delchild(u)
                    visited[u]=1
                else:
                    delchild(u)
    ...