#include <bits/stdc++.h>
using Int = int64_t;
constexpr Int INF = INT_MAX;
constexpr Int mod = 1e9 + 7;
void calc() {
  Int N;
  std::cin >> N;
  std::vector<Int> A(N);
  for (Int(i) = 0; (i) < (N); ++(i)) std::cin >> A[i];
  std::vector<Int> S(N + 1);
  S[0] = 0;
  for (Int i = 1; i <= N; ++i) {
    S[i] = S[i - 1] + A[i - 1];
  }
  Int ans = 0;
  std::sort(S.begin(), S.end());
  for (Int i = 1; i <= N; ++i) {
    if (S[i] == S[i - 1]) ans++;
  }
  std::cout << ans;
}
int main() {
  calc();
  return 0;
}
