#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 5;
long long a[maxn];
long long sum[maxn];
map<long long, long long> cnt;
signed main() {
  long long n;
  cin >> n;
  sum[0] = 0;
  cnt[0] = 1;
  long long L = -1;
  long long ans = 0;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
    if (cnt[sum[i]] && cnt[sum[i]] >= L - 1) {
      ans++;
      L = i;
    }
    cnt[sum[i]] = i;
  }
  cout << ans << endl;
  return 0;
}
