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