#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<vector<int> > a(N);
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    a[i].push_back(tmp);
  }
  int counter = 0;
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < a[i - 1].size(); j++) {
      if ((a[i - 1][j] + a[i][0]) != 0) {
        a[i].push_back(a[i - 1][j] + a[i][0]);
      } else {
        a[i].push_back(0);
        counter++;
      }
    }
  }
  cout << counter << endl;
}
