#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long int> s(N + 1);
  s[0] = 0;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    s[i + 1] = s[i] + tmp;
  }
  int cnt = 0;
  sort(s.begin(), s.end());
  for (int i = 0; i < N; i++) {
    if (s[i] == s[i + 1]) {
      cnt++;
    }
  }
  cout << cnt;
}
