#include <bits/stdc++.h>
int main() {
  long input[200000];
  int zero_box[2][5000] = {0};
  int step;
  int count = 0;
  scanf("%d", &step);
  for (int i = 0; i < step; i++) {
    scanf("%d", &input[i]);
  }
  int check = 0;
  for (int i = 0; i < step; i++) {
    check = 0;
    for (int j = i; j < step; j++) {
      check += input[j];
      if (check == 0) {
        count++;
      }
    }
  }
  printf("%d", count);
  return 0;
}
