#include <bits/stdc++.h>
int main() {
  std::vector<int> A;
  int N;
  std::cin >> N;
  for (int i = 0; i < N; i++) {
    int tmp;
    std::cin >> tmp;
    A.push_back(tmp);
  }
  int count = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = i + 1; j <= N; j++) {
      int sum = std::accumulate(A.begin() + i - 1, A.begin() + j, 0);
      if (sum == 0) {
        count++;
      }
    }
  }
  std::cout << count << std::endl;
}
