#include <bits/stdc++.h>
using namespace std;
int count_zero(long long arg[], int n) {
  int count = 0;
  for (int i = 0; i < n; ++i) {
    if (arg[i] == 0) ++count;
  }
  return count;
}
int main() {
  int N;
  cin >> N;
  long long A[200050];
  for (int i = 0; i < N; ++i) cin >> A[i];
  long long B[200050];
  for (int i = 0; i < N; ++i) B[i] = A[i];
  int res = count_zero(A, N);
  for (int j = 1; j < N; ++j) {
    for (int k = 0; k < N - j; ++k) B[k] = A[k] + B[k + 1];
    res += count_zero(B, N - j);
  }
  cout << res << endl;
}
