#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  long a[200000];
  for (int i = 0; i < n; ++i) {
    scanf("%ld", &(a[i]));
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    long sum = 0;
    for (int j = i; j < n; ++j) {
      sum += a[j];
      if (sum == 0) {
        cnt++;
      }
    }
  }
  printf("%d\n", cnt);
}
