#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int a[n];
  int i, j, k, l;
  int count = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int sum;
  for (i = 0; i < n - 1; i++) {
    sum = a[i];
    for (j = i + 1; j < n; j++) {
      sum += a[j];
      if (sum == 0) {
        count++;
        break;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
