#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> sum(N);
  int num = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] == 0) num++;
  }
  if (N == 1) {
    cout << num << endl;
    return 0;
  }
  sum[0] = A[0] + A[1];
  if (sum[0] == 0) {
    num++;
  }
  for (int i = 2; i < N; i++) {
    for (int j = 0; j < i - 1; j++) {
      sum[j] = sum[j] + A[i];
      if (sum[j] == 0) num++;
    }
    sum[i - 1] = A[i - 1] + A[i];
    if (sum[i - 1] == 0) num++;
  }
  cout << num << endl;
  return 0;
}
