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