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