#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n, j, k, l;
  long int b = 0, count = 0;
  cin >> n;
  vector<long int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (j = 2; j <= n; j++) {
    for (k = 0; k <= n - j; k++) {
      for (l = 0; l < j; l++) {
        b += a.at(l + k);
      }
      if (b == 0) {
        count++;
      }
      b = 0;
    }
  }
  cout << count << endl;
  return 0;
}
