#include <bits/stdc++.h>
int main(int argc, char const* argv[]) {
  int n;
  scanf("%d", &n);
  long long int* a = new long long int[n];
  for (int i = 0; i < n; i++) {
    scanf("%lld", a + i);
  }
  long long int count = 0;
  for (int i = 0; i < n; i++) {
    long long int current = 0;
    for (int j = i; j < n; j++) {
      current += a[j];
      if (current == 0) count++;
    }
  }
  printf("%lld\n", count);
  return 0;
}
