#include <bits/stdc++.h>
using namespace std;
int main() {
  long N = 0, a = 0, b = 0, c = 0, ans = 0;
  long long sum;
  scanf("%ld", &N);
  vector<long long> array(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &array[i]);
  }
  for (int i = 0; i < N; i++) {
    sum = 0;
    for (int k = i; k < N; k++) {
      sum += array[k];
      if (sum == 0) ++ans;
    }
  }
  printf("%ld\n", ans);
}
