#include <bits/stdc++.h>
int main() {
  int N;
  long long int *M;
  std::cin >> N;
  M = new long long int[N + 1];
  M[0] = 0;
  for (int i = 0; i < N; ++i) {
    int a;
    std::cin >> a;
    M[i + 1] = M[i] + a;
  }
  int count = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N + 1; ++j) {
      count += M[i] == M[j] ? 1 : 0;
    }
  }
  std::cout << count << std::endl;
  delete[](M);
  return 0;
}
