#include <bits/stdc++.h>
using namespace std;
int counter(int j, int *a, int n) {
  int x = 0;
  int cc = 0;
  for (int i = j; i < n; ++i) {
    x += a[i];
    if (x == 0) {
      cc++;
    }
  }
  return cc;
}
int main() {
  int a[200001] = {0};
  int n = 0;
  int count = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int j = 0; j < n; ++j) {
    count += counter(j, a, n);
  }
  cout << count;
  return 0;
}
