#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long a[200000];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int counter = 0;
  for (int i = 0; i < n; i++) {
    long long t = 0;
    for (int k = 0; k < n - i; k++) {
      t += a[k + i];
      if (t == 0) {
        counter++;
      }
    }
  }
  cout << counter << endl;
  return 0;
}
