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