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