#include <bits/stdc++.h>
using namespace std;
long long a[200005];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    a[0] = 0;
    long long x;
    map<long long, long long> mp;
    for (int i = 1; i <= n; i++) {
      scanf("%lld", &x);
      a[i] = a[i - 1] + x;
      mp[a[i]]++;
    }
    long long sum = 0;
    sort(a + 1, a + 1 + n);
    if (a[1] == 0) sum++;
    for (int i = 2; i <= n; i++) {
      if (a[i] == a[i - 1]) sum++;
    }
    if (sum % 2 == 0) sum *= 2;
    printf("%lld\n", sum);
  }
  return 0;
}
