#include <bits/stdc++.h>
using namespace std;
long long int n, a[200005], d[200005], v[200005], ans;
int main() {
  cin >> n;
  for (long long int i = (long long int)0; i < (long long int)n; i++) {
    cin >> a[i];
    if (i > 0) {
      d[i] = d[i - 1] + a[i];
    } else {
      d[i] = a[i];
    }
    if (d[i] == 0) ans++;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (d[i] - d[j] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
