#include <bits/stdc++.h>
int main(int argc, const char* argv[]) {
  int N, i, j, c;
  int b = 0;
  int count = 0;
  scanf("%d\n", &N);
  int a[N];
  for (i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  for (c = 0; c < N; c++) {
    for (i = c; i < N + 1; i++) {
      b = 0;
      for (j = c; j < i; j++) {
        b += a[j];
      }
      if (b == 0 & i != c) {
        count++;
      }
    }
  }
  printf("%d\n", count);
  return 0;
}
