#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int64_t a;
  vector<int64_t> s(n + 1);
  s[0] = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    s[i + 1] = s[i] + a;
  }
  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());
  cout << n + 1 - s.size() << "\n";
  return 0;
}
