#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
const int INF = 1000000007;
using namespace std;
using Graph = vector<vector<int>>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long fac(long long a) { return a > 1 ? fac(a - 1) * a : 1; }
int Rand() { return (rand() % 32768) * 32768 + (rand() % 32768); }
int solve() {
  int n;
  cin >> n;
  int L = 0, R = 0;
  vector<long long> sum(n + 1), v(n);
  for (int i = 0; i < (n); ++i) cin >> v[i];
  for (int i = 0; i < (n); ++i) sum[i + 1] = sum[i] + v[i];
  sort((sum).begin(), (sum).end());
  int ans = 0;
  for (int i = 0; i < (n); ++i) {
    if (sum[i] == sum[i + 1]) ans++;
  }
  cout << ans << endl;
  return 0;
}
int main() {
  solve();
  return 0;
}
