#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int length;
  long long int* chain;
  long long int* s;
  cin >> length;
  chain = new long long int[length];
  s = new long long int[length + 1];
  for (long long int i = 0; i < length; i++) cin >> chain[i];
  s[0] = chain[0];
  for (long long int i = 1; i < length; i++) s[i] = s[i - 1] + chain[i];
  s[length] = 0;
  sort(s, s + length + 1);
  long long int count = 0;
  long long int old = s[0];
  for (long long int i = 1; i < length + 1; i++) {
    if (old == s[i]) count++;
    old = s[i];
  }
  cout << count;
}
