#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int* a = new int[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int zero = 0;
  for (int i = 0; i < n; i++) {
    int total = 0;
    for (int j = i; j < n; j++) {
      total += a[j];
      if (total == 0) {
        zero++;
      }
    }
  }
  printf("%d\n", zero);
  return 0;
}
