#include <bits/stdc++.h>
int main(void) {
  int N;
  int A[200000] = {0};
  int i;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  int m, n;
  int sum, score;
  for (m = 0; m < N; m++) {
    for (n = m; n < N; n++) {
      sum = 0;
      for (i = m; i <= n; i++) {
        sum += A[i];
      }
      if (sum == 0) {
        score++;
      }
    }
  }
  printf("%d\n", score);
  return 0;
}
