#include <bits/stdc++.h>
using namespace std;
int xx, a[200010], N, ans1, sum;
int main() {
  cin >> N;
  for (int x = 1; x++; x < N) {
    cin >> xx;
    a[x] = xx;
  }
  for (int y = 1; y++; y < N) {
    sum = 0 + a[y];
    for (int z = y + 1; z++; z < N - y + 1) sum = sum + a[z];
    if (sum == 0) {
      ans1++;
    }
  }
  cout << ans1;
  return 0;
}
