#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n + 1, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) b[i + 1] = b[i] + a[i];
  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;
  return 0;
}
