#include <bits/stdc++.h>
using namespace std;
int N;
int M = 0;
int res = 0;
int A[200001];
void solve() {
  for (int j = 0; j < N; j++) {
    for (int k = 0; k < N - j; k++) {
      M += A[j + k];
      if (M == 0) res++;
    }
    M = 0;
  }
}
int main() {
  cin >> N;
  for (int j = 0; j < N; j++) {
    cin >> A[j];
  }
  solve();
  cout << res << endl;
}
