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