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