#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
  long long int A, B, C, D, E, L, R, X, Y, W, H, N, M, K, sum = 0, num = 0,
                                                          flag = 0;
  string S, T;
  cin >> N;
  vector<long long int> P(N, 0);
  for (long long int i = 0; i < N; i++) cin >> P[i];
  for (long long int i = 1; i < N; i++) P[i] += P[i - 1];
  P.push_back(0);
  sort(P.begin(), P.end());
  for (long long int i = 1; i < N + 1; i++)
    if (P[i] == P[i - 1]) sum++;
  cout << sum << endl;
}
