#include <bits/stdc++.h>
int main() {
  int N;
  std::cin >> N;
  std::vector<int> A;
  for (int i = 0; i < N; i++) {
    int tmp;
    std::cin >> tmp;
    A.push_back(tmp);
  }
  int sum = 0;
  int counter = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      sum += A[j];
      if (sum == 0) {
        counter++;
      }
    }
    sum = 0;
  }
  std::cout << counter << std::endl;
  return 0;
}
