#include <bits/stdc++.h>
using namespace std;
int main() {
  std::string str;
  int okada[1000000];
  int a = 0, count = 0;
  std::cin >> a;
  for (int i = 0; i < a; i++) {
    std::cin >> okada[i];
  }
  for (int j = 0; j < a; j++) {
    for (int k = j + 1; k < a; k++) {
      okada[j] += okada[k];
      if (okada[j] == 0) {
        count++;
      }
    }
  }
  std::cout << count << std::endl;
}
