#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 0;
  cin >> n;
  int** a = new int*[n];
  for (int i = 0; i < n; i++) {
    a[i] = new int[n];
  }
  for (int i = 0; i < n; i++) {
    cin >> a[0][i];
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < n - i; j++) {
      a[i][j] = a[i - 1][j] + a[0][j + i];
      if (a[i][j] == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
