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