#include <bits/stdc++.h>
using namespace std;
int main() {
  int answer = 0;
  int N;
  vector<int> A;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    A.push_back(tmp);
  }
  int num = 0;
  auto iter = A.begin();
  while (iter != A.end()) {
    for (auto iter2 = iter; iter2 != A.end(); iter2++) {
      num += *iter2;
      if (num == 0) {
        answer++;
      }
    }
    num = 0;
    iter++;
  }
  cout << answer << endl;
  return 0;
}
