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