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