#include <bits/stdc++.h>
using namespace std;
typedef vector<vector<int> > vii;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < ((int)(n)); i++) cin >> a[i];
  long long cnt;
  long long answer = 0LL;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      cnt = 0;
      for (int k = i; k <= j; ++k) cnt += a[k];
      if (cnt == 0) ++answer;
    }
  }
  cout << answer << '\n';
}
