#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  int count = 0;
  int length, sum = 0;
  int *receiveArray;
  scanf("%d\n", &length);
  receiveArray = (int *)malloc(length * sizeof(int));
  for (int i = 0; i < length; i++) {
    scanf("%d", &receiveArray[i]);
  }
  for (int i = 1; i <= length; i++) {
    for (int j = 0; i + j <= length; j++) {
      for (int k = 0; k < i; k++) {
        sum += receiveArray[j + k];
      }
      if (sum == 0) {
        count++;
      }
      sum = 0;
    }
  }
  free(receiveArray);
  printf("%d\n", count);
  return 0;
}
