#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N = 0;
  cin >> N;
  int *A;
  A = (int *)malloc(N * sizeof(int));
  int sum = 0;
  int flag = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int s = 0; s < N - 1; s++) {
    for (int e = s + 1; e < N; e++) {
      for (int k = s; k <= e; k++) {
        sum += A[k];
      }
      if (sum == 0) {
        flag++;
      }
      sum = 0;
    }
  }
  cout << flag << endl;
  free(A);
  return 0;
}
