#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, input, sum, res = 0;
  vector<int> A;
  cin >> N;
  while (cin >> input) A.push_back(input);
  for (int i = 0; i < N; i++) {
    sum = 0;
    for (int j = i; j < N; j++) {
      sum += A[j];
      if (sum == 0) res++;
    }
  }
  cout << res << endl;
  return 0;
}
