#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
int ans = 0;
int i_index;
int tmp;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];
int main() {
  cin >> N;
  int A[N];
  for (int i = 0; i < (int)(N); i++) cin >> A[i];
  for (int i = 0; i < (int)(N); i++) {
    for (int j = 0; j < (int)(N); j++) {
      if (i + j <= N) {
        ans += A[i + j];
        if (ans == 0) {
          cnt++;
          ans = 0;
        }
      }
    }
    ans = 0;
  }
  cout << cnt << endl;
  return 0;
}
