#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  long long cnt = 0, sum;
  cin >> n;
  int a[n];
  for (long long i = (0); i < (n); i++) cin >> a[i];
  for (long long i = (0); i < (n); i++) {
    sum = 0;
    for (long long j = (i); j < (n); j++) {
      sum += a[j];
      if (sum == 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
