#include <bits/stdc++.h>
using namespace std;
using ll = long long;
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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n - 1);
  return ans * n;
}
ll gcd(ll a, ll b) {
  if (a < b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
int main() {
  ll n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < (int)(n); i++) cin >> v.at(i);
  vector<ll> sum(n + 1, 0);
  for (int i = 0; i < (int)(n); i++) sum.at(i + 1) += sum.at(i) + v.at(i);
  ll ans = 0;
  sort(sum.begin(), sum.end());
  for (int i = 0; i < (int)(n); i++) {
    if (sum.at(i) == sum.at(i + 1)) {
      ans++;
    }
  }
  cout << ans << endl;
}
