#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
using Data = pair<long long, vector<long long> >;
int main() {
  long long n;
  cin >> n;
  vector<long long> vec(n);
  vector<long long> s(n + 1);
  long long ans = 0;
  s[0] = 0;
  for (long long i = 0; i < (n); i++) {
    cin >> vec[i];
    s[i + 1] = s[i] + vec[i];
  }
  sort(s.begin(), s.end());
  for (long long i = 0; i < (n); i++)
    if (s[i] == s[i + 1]) ans++;
  cout << ans << endl;
  return 0;
}
