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