#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *v = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int l = 0;
  int r = 1;
  int cnt = 0;
  for (l = 0; l < n - 1; l++) {
    for (r = 1; l < n; r++) {
      int calc = 0;
      for (int i = l; i < r; i++) {
        calc += v[i];
      }
      if (calc == 0) {
        cnt++;
      }
    }
  }
  delete (v);
  cout << cnt;
  return 0;
}
