#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  int sum, cnt = 0;
  ;
  for (int l = 0; l < N - 1; l++) {
    for (int r = l + 1; r < N; r++) {
      sum = 0;
      for (int i = l; i <= r; i++) {
        sum += A[i];
      }
      if (sum == 0) cnt++;
    }
  }
  cout << cnt << endl;
}
