#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  int A[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", A + i);
  }
  int S[N + 1];
  S[0] = 0;
  int s = 0;
  for (int i = 0; i < N; i++) {
    s += A[i];
    S[i + 1] = s;
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j <= N; j++) {
      int sum = S[j] - S[i];
      if (sum == 0) count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
