#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long INF = 1 << 29;
int main() {
  long long N;
  std::cin >> N;
  std::vector<long long> S(N + 1, 0);
  for (auto i = 0; i < N; ++i) {
    long long a;
    std::cin >> a;
    S[i + 1] = S[i] + a;
  }
  long long result = 0;
  for (auto i = 1; i < N + 1; ++i) {
    for (auto j = 0; j < i; ++j) {
      if (i == j) continue;
      if (S[i] - S[j] == 0) result++;
    }
  }
  std::cout << result << std::endl;
}
