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