#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<long long> as;
  std::vector<long long> ss;
  ss.push_back(0);
  long long sum = 0;
  for (int i = 0; i < n; ++i) {
    long long a;
    std::cin >> a;
    as.push_back(a);
    sum += a;
    ss.push_back(sum);
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n + 1; ++j) {
      if (ss[j] - ss[i] == 0) {
        ++ans;
      }
    }
  }
  std::cout << ans << std::endl;
}
