#include <bits/stdc++.h>
using namespace std;
int A[200000];
int minians;
int main() {
  int ans = 0, n;
  int i = 0, j = 0, k = 0;
  cin >> n;
  for (i = 0; i <= n - 1; i++) cin >> A[i];
  for (j = 0; j <= n - 1; j++) {
    minians = 0;
    for (k = 0; k + j <= n - 1; k++) {
      minians += A[j + k];
      if (minians == 0) ans++;
    }
  }
  cout << ans << endl;
}
