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