#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (long long &a : A) cin >> a;
  int ans = 0;
  int sum = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j + i - 1 < N; j++) {
      sum = 0;
      for (int k = j; k <= j + i - 1; k++) {
        sum += A[k];
      }
      if (sum == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
