#include <bits/stdc++.h>
int main() {
  int n;
  int *s;
  int i, j, tmp, cnt = 0;
  scanf("%d", &n);
  s = (int *)calloc(sizeof(int), n + 1);
  for (i = 0; i < n; i++) {
    scanf("%d", &tmp);
    for (j = i + 1; j < n + 1; j++) {
      s[j] += tmp;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n + 1; j++) {
      if (s[i] == s[j]) cnt++;
    }
  }
  free(s);
  printf("%d\n", cnt);
  return 0;
}
