#include <bits/stdc++.h>
int main() {
  int N;
  std::cin >> N;
  std::vector<int> A;
  std::vector<int> tmp;
  A.reserve(200000);
  tmp.reserve(200000);
  for (int n = 0; n < N; n++) {
    int a;
    std::cin >> a;
    A.emplace_back(a);
  }
  int count = 0;
  for (int n = 0; n < N; n++) {
    for (int i = 0; i < n; i++) {
      tmp[i] += A[n];
      if (tmp[i] == 0) {
        count++;
      }
    }
    tmp.emplace_back(A[n]);
    if (A[n] == 0) {
      count++;
    }
  }
  std::cout << count << std::endl;
  return 0;
}
