#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[200001], ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i) a[i] = a[i] + a[i - 1];
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) ans++;
    if (a[i] == a[i - 1]) ans++;
  }
  cout << ans << endl;
  return 0;
}
