#include <bits/stdc++.h>
using namespace std;
int n;
int sum[200000 + 2], k;
int a[200000 + 2];
int ans = 0;
set<int> le;
map<int, int> mp;
void solve() {
  int i, j;
  le.clear();
  mp.clear();
  bool flag = false;
  int s, e;
  for (i = n; i >= 1; i--) {
    le.insert(sum[i]);
    mp[sum[i]] = i;
    if (le.find(sum[i - 1] + k) != le.end()) {
      s = i;
      e = mp[sum[i - 1] + k];
      flag = true;
      ans++;
    }
  }
  printf("%d\n", ans);
}
int main() {
  int i, j, t, ca = 0;
  while (~scanf("%d", &n)) {
    for (i = 1; i < n + 1; i++) {
      scanf("%d", &a[i]);
      sum[i] = sum[i - 1] + a[i];
    }
    k = 0;
    solve();
  }
  return 0;
}
