#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  set<long long> s;
  vector<long long> a;
  long long p[200005], ans = 0;
  memset(p, 0, sizeof(p));
  cin >> n;
  s.insert(0);
  for (int i = 1; i <= n; i++) {
    cin >> x;
    a.push_back(x);
    p[i] = p[i - 1] + x;
    if (s.find(p[i]) == s.end())
      s.insert(p[i]);
    else {
      ans++;
      s.clear();
      p[i] = x;
      s.insert(0);
      s.insert(x);
    }
  }
  cout << ans << endl;
  return 0;
}
