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