#include <bits/stdc++.h>
int suming(int a[100000], int i, int j, int k) {
  if (k < i)
    return suming(a, i, j, k + 1) + a[j + k];
  else
    return 0;
}
int main(void) {
  int n;
  int a[100000];
  int count = 0;
  int i, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 2; i <= n; i++) {
    for (j = 0; j <= n - i; j++) {
      int sum = 0;
      sum = suming(a, i, j, 0);
      if (sum == 0) count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
