#include <bits/stdc++.h>
int main() {
  int N;
  scanf("%d", &N);
  int A[2 * 100000];
  for (int i = 0; i < N; i++) {
    scanf("%d", &N);
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    int asum = 0;
    int j = i + 1;
    for (int j = i; j < N; j++) {
      asum += A[j];
      if (asum == 0) {
        cnt++;
      }
    }
  }
  printf("%d\n", cnt);
}
