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