#include <bits/stdc++.h>
static const long long MOD = 1000000007;
static const long long INF = 1000000000000000000LL;
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> souwa(n);
  for (long long i = 0; i < (n); i++) {
    cin >> a[i];
  }
  souwa[0] = a[0];
  for (long long i = 0; i < (n - 1); i++) {
    souwa[i + 1] = souwa[i] + a[i + 1];
  }
  sort(souwa.begin(), souwa.end());
  long long cnt = 0;
  long long cur = souwa[0];
  for (long long i = 1; i < n; ++i) {
    if (cur == souwa[i]) ++cnt;
    cur = souwa[i];
  }
  cout << cnt << endl;
  return 0;
}
