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