#include <bits/stdc++.h>
using namespace std;
const long long int N = 3e5 + 5;
bool fun(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first)
    return a.second < b.second;
  else
    return a.first < b.first;
}
bool prime(long long int n) {
  if (n == 1) return false;
  for (long long int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
long long int getSetBitsFromOneToN(long long int N) {
  long long int two = 2, ans = 0;
  long long int n = N;
  while (n) {
    ans += (N / two) * (two >> 1);
    if ((N & (two - 1)) > (two >> 1) - 1)
      ans += (N & (two - 1)) - (two >> 1) + 1;
    two <<= 1;
    n >>= 1;
  }
  return ans;
}
long long int power(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int mod_pow(long long int a, long long int b, long long int m) {
  long long int res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % m;
    }
    a = (a * a) % m;
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return (max(a, b) / gcd(a, b)) * min(a, b);
}
long long int mod_inverse(long long int a) {
  return mod_pow(a, 1000000007 - 2, 1000000007);
}
bool lodu(long long int n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
long long int raju[N];
void SieveOfEratosthenes(long long int n) {
  bool prime[n + 1];
  long long int i = 0;
  memset(prime, true, sizeof(prime));
  for (long long int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long int p = 2; p <= n; p++)
    if (prime[p]) raju[i++] = p;
}
void solve() {
  long long int n;
  cin >> n;
  long long int a[n + 1];
  for (long long int i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  multiset<long long int> s;
  long long int ans = 0;
  s.insert(0);
  long long int curr = 0;
  for (long long int i = 1; i < n + 1; i++) {
    curr += a[i];
    if (s.find(curr) != s.end()) {
      s.clear();
      ans++;
      curr = a[i];
      s.insert(curr);
      s.insert(0);
    } else {
      s.insert(curr);
    }
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
}

### Prompt

Develop a solution in Cpp to the problem described below:

Kolya got an integer array a_1, a_2, ..., 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 ≤ n ≤ 200 000) — the number of elements in Kolya's array.

The second line of the input contains n integers a_1, a_2, ..., a_n (-10^{9} ≤ a_i ≤ 10^{9}, a_i ≠ 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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long int N = 3e5 + 5;
bool fun(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first)
    return a.second < b.second;
  else
    return a.first < b.first;
}
bool prime(long long int n) {
  if (n == 1) return false;
  for (long long int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
long long int getSetBitsFromOneToN(long long int N) {
  long long int two = 2, ans = 0;
  long long int n = N;
  while (n) {
    ans += (N / two) * (two >> 1);
    if ((N & (two - 1)) > (two >> 1) - 1)
      ans += (N & (two - 1)) - (two >> 1) + 1;
    two <<= 1;
    n >>= 1;
  }
  return ans;
}
long long int power(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int mod_pow(long long int a, long long int b, long long int m) {
  long long int res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % m;
    }
    a = (a * a) % m;
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return (max(a, b) / gcd(a, b)) * min(a, b);
}
long long int mod_inverse(long long int a) {
  return mod_pow(a, 1000000007 - 2, 1000000007);
}
bool lodu(long long int n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
long long int raju[N];
void SieveOfEratosthenes(long long int n) {
  bool prime[n + 1];
  long long int i = 0;
  memset(prime, true, sizeof(prime));
  for (long long int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long int p = 2; p <= n; p++)
    if (prime[p]) raju[i++] = p;
}
void solve() {
  long long int n;
  cin >> n;
  long long int a[n + 1];
  for (long long int i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  multiset<long long int> s;
  long long int ans = 0;
  s.insert(0);
  long long int curr = 0;
  for (long long int i = 1; i < n + 1; i++) {
    curr += a[i];
    if (s.find(curr) != s.end()) {
      s.clear();
      ans++;
      curr = a[i];
      s.insert(curr);
      s.insert(0);
    } else {
      s.insert(curr);
    }
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
}

```