#include <bits/stdc++.h>
using namespace std;
int n;
long long a[200000];
long long dp[200000];
int func(int p, int sum) {
  if (p == -1) return sum;
  for (int i = p; i >= 0; i--) {
    dp[i] -= a[p];
    if (dp[i] == 0) sum++;
  }
  return func(p - 1, sum - 1);
}
void solve() {
  int res = 0;
  long long cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    cnt += a[i];
    dp[i] = cnt;
    if (cnt == 0) res++;
  }
  res += func(n - 1, 0);
  cout << res << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  solve();
  return 0;
}
