#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> A(n);
  for (int i = 0; i < (n); i++) {
    cin >> A[i];
  }
  vector<long long> B(n + 1);
  B[0] = 0;
  for (int i = 0; i < (n); i++) {
    B[i + 1] = B[i] + A[i];
  }
  int ans = 0;
  sort((B).begin(), (B).end());
  ;
  for (int i = 0; i < (n); i++) {
    if (B[i] == B[i + 1]) {
      ans++;
    }
  }
  cout << ans << endl;
}
