#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];
  int s = 0;
  for (int i = 0; i < N; i++) {
    s += A[i];
    S[i] = s;
  }
  int count = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int sum;
      if (i == 0) {
        sum = S[j];
      } else {
        sum = S[j] - S[i - 1];
      }
      if (sum == 0) count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
