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