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