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