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