#include <bits/stdc++.h>
int ar(int start, int end, long* A) {
  static long data[200000][3];
  static int size = 0;
  static int flag = 0;
  if (flag == 0) {
    flag = 1;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 200000; j++) {
        data[j][i] = -100000001L;
      }
    }
  }
  if (start == end) {
    return A[start];
  }
  for (int i = 0; i < size; i++) {
    if (data[i][0] == start && data[i][1] == end) {
      return data[i][2];
    }
  }
  data[size][0] = start;
  data[size][1] = end;
  data[size][2] = 0L;
  for (int i = start; i <= end; i++) {
    data[size][2] += A[i];
  }
  size++;
  return data[size - 1][2];
}
int main(void) {
  int N, count = 0;
  long A[200000];
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%ld", &A[i]);
  }
  for (int start = 0; start < N; start++) {
    for (int end = start; end < N; end++) {
      if (ar(start, end, A) == 0) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
