#include <bits/stdc++.h>
int main() {
  int n, sum = 0, count = 0;
  scanf("%d", &n);
  int num[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &num[i]);
  }
  for (int l = 0; l < n; l++) {
    for (int j = l; j < n; j++) {
      sum += num[j];
      if (sum == 0) {
        count++;
      }
    }
    sum = 0;
  }
  printf("%d", count);
  return 0;
}
