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