#include <bits/stdc++.h>
using namespace std;
template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> ans(n + 1);
  ans[0] = 0;
  for (int i = 0; i <= n - 1; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    ans[i] = ans[i - 1] + a[i - 1];
  }
  int cont = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      if (!(ans[i] - ans[j])) {
        cont++;
      }
    }
  }
  cout << cont << '\n';
}
