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