#include <bits/stdc++.h>
int main() {
  int N;
  scanf("%d", &N);
  int a, b, n, i, M[N];
  b = 0;
  for (n = 0; n != N; n++) {
    scanf("%d", &M[n]);
  }
  for (n = 0; n != N; n++) {
    a = M[n];
    for (i = (n + 1); i != N; i++) {
      a += M[i];
      if (a == 0) {
        b++;
      }
    }
  }
  printf("%d", b);
}
