#include <bits/stdc++.h>
int main() {
  int n = 0, sum = 0, count = 0;
  int a[200000] = {};
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    sum += a[i];
    for (int j = i + 1; j < n; j++) {
      sum += a[j];
      if (sum == 0) {
        count++;
      }
    }
    sum = 0;
  }
  std::cout << count << std::endl;
  return 0;
}
