#include <bits/stdc++.h>
using namespace std;
long long int a[10000000], n, pul, ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    pul = 0;
    for (int u = i; u < n; u++) {
      pul += a[u];
      if (pul == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
