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