#include <bits/stdc++.h>
void getInput(std::vector<int> *v);
int main(void) {
  std::vector<int> v;
  int count = 0, sum;
  getInput(&v);
  getInput(&v);
  for (int i = 1; i < v[0]; i++) {
    sum = v[i];
    for (int j = i + 1; j < v[0] + 1; j++) {
      sum += v[j];
      if (sum == 0) count++;
    }
  }
  std::cout << count << std::endl;
}
void getInput(std::vector<int> *v) {
  std::string s, buf;
  std::getline(std::cin, s);
  std::stringstream ss(s);
  while (std::getline(ss, buf, ' ')) {
    (*v).push_back(std::stoi(buf));
  }
}
