#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  for (signed i = 0; i < n; ++i) cin >> a[i];
  long long res = 0;
  for (signed i = 0; i < n; ++i) {
    for (long long j = i; j < n; ++j) {
      long long sum = 0;
      for (long long k = i; k <= j; ++k) {
        sum += a[k];
      }
      if (sum == 0) res++;
    }
  }
  cout << res;
  return 0;
}
