#include <bits/stdc++.h>
using namespace std;
std::vector<long long int> v;
int main() {
  long long int N;
  cin >> N;
  for (long long int i = 0; i < N; i += 1) {
    long long int x;
    cin >> x;
    v.push_back(x);
  }
  long long int ans = 0;
  for (long long int i = 0, j = 1; i < N;) {
    if (j > N) {
      i += 1;
      j = i + 1;
      continue;
    }
    long long int sum = 0;
    for (long long int a = i; a < j; a += 1) {
      sum += v[a];
    }
    if (sum == 0) {
      ans += 1;
    }
    j += 1;
  }
  cout << ans;
}
