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