#include <bits/stdc++.h>
int N;
int64_t l[200000];
int main() {
  scanf("%d", &N);
  int64_t s = 0;
  l[0] = 0;
  int count = 0;
  for (int i = 0; i < N; i++) {
    int tmp;
    scanf(" %d", &tmp);
    l[i + 1] = tmp + l[i];
    for (int lp = i; lp >= 0; lp--) {
      if (l[lp] == l[i + 1]) count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
