#include <bits/stdc++.h>
using namespace std;
long long INF = 1e15;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<long long> b(n + 1);
  b[0] = 0;
  for (int i = 1; i <= n; i++) {
    b[i] = a[i] + b[i - 1];
  }
  sort(b.begin(), b.end());
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] == b[i + 1]) ans++;
  }
  cout << ans << endl;
}
