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