#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[100000], count = 0, an = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      for (int k = j; k <= i; k++) {
        count += a[k];
      }
      if (count == 0) {
        an++;
      }
      count = 0;
    }
  }
  cout << an << endl;
  getchar();
  getchar();
  return 0;
}
