#include <bits/stdc++.h>
using namespace std;
int total = 0;
int n, a[200001];
int main() {
  int i;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  int j, s;
  for (i = 0; i < n; i++) {
    s = 0;
    for (j = i; j < n; j++) {
      s = s + a[j];
      if (s == 0) total += 1;
    }
  }
  cout << total << endl;
  return 0;
}
