#include <bits/stdc++.h>
using namespace std;
using namespace std;
template <class T = long long>
T in() {
  T _in;
  cin >> _in;
  return (_in);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N = in();
  long long val[200000];
  int cnt = 0;
  for (int i = 0; i < (int)(N); i++) {
    val[i] = in();
    if (val[i] == 0) cnt++;
  }
  for (int i = N - 1; i > -1; i--) {
    for (int j = i + 1; j < N; j++) {
      val[j] = val[i] + val[j];
      if (val[j] == 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
