#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int p[200001];
  int count = 0;
  for (size_t i = 0; i < N; i++) {
    int A;
    cin >> A;
    p[i] = A;
    for (size_t j = 0; j < i; j++) {
      p[j] += A;
      count += p[j] == 0;
    }
  }
  cout << count;
  return 0;
}
