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