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