#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int count = 0;
  for (int j = 0; j < N; j++) {
    int check = 0;
    for (int k = j; k < N; k++) {
      check += vec.at(k);
      if (check == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
}
