#include <bits/stdc++.h>
int main() {
  long N;
  std::cin >> N;
  std::vector<long> S(N);
  long ans = 0;
  for (size_t i = 0; i < N; i++) {
    long a;
    std::cin >> a;
    for (size_t j = 0; j < i + 1; j++) {
      S[j] += a;
      if (S[j] == 0) ans++;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
