#include <bits/stdc++.h>
using namespace std;
long findCache(long, long);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  long long cache[199999][2] = {{0}};
  int input, ans = 0;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> input;
    for (int j = 0; j <= i; ++j) {
      cache[j][i % 2] = cache[j][(i + 1) % 2] + input;
      if (cache[j][i % 2] == 0) {
        ++ans;
      }
    }
  }
  cout << ans << "\n";
}
