#include <bits/stdc++.h>
int main() {
  using namespace std;
  int N;
  cin >> N;
  vector<int> ints;
  ints.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> ints[i];
  }
  int result = 0;
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = i; j < N; j++) {
      sum += ints[j];
      if (sum == 0) {
        result++;
      }
    }
  }
  cout << result << endl;
  return 0;
}
