#include <bits/stdc++.h>
int main() {
  int n = 0, sum = 0, count = 0;
  int memory = 0;
  int vec, func = 0;
  std::vector<int> a = {};
  std::vector<int> some = {};
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> vec;
    a.push_back(vec);
    func += vec;
    some.push_back(func);
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < some.size(); j++) {
      if (some[j] == 0) {
        count++;
      }
      some[j] -= some[0];
    }
    some.erase(some.begin());
  }
  std::cout << count << std::endl;
  return 0;
}
