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