#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  int cnt = 0;
  long long inp;
  cin >> n;
  std::vector<long long> a(n);
  std::vector<long long> s(n + 1);
  for (int i = 0; i < n; ++i) {
    cin >> inp;
    a.at(i) = inp;
    s.at(i + 1) = s.at(i) + inp;
  }
  sort(s.begin(), s.end());
  for (int i = 0; i + 1 <= n; ++i) {
    if (s.at(i) == s.at(i + 1)) ++cnt;
  }
  cout << (cnt) << endl;
  return 0;
}
