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