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