#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = (0); i < (N); ++i) cin >> A[i];
  int count = 0;
  for (int i = (0); i < (N); ++i) {
    long long part_sum = 0;
    for (int j = (i); j < (N); ++j) {
      part_sum += A[j];
      if (part_sum == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  system("pause");
  return 0;
}
