#include <bits/stdc++.h>
int main(void) {
  int n;
  scanf("%d", &n);
  long long int a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int zero_sum = 0;
  for (int start = 0; start < n; start++) {
    for (int end = start + 1; end < n; end++) {
      int sum = 0;
      for (int i = start; i <= end; i++) {
        sum += a[i];
      }
      if (sum == 0) {
        zero_sum++;
      }
    }
  }
  printf("%d", zero_sum);
  return 0;
}
