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