#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto&& e : a) {
    cin >> e;
  }
  vector<int64_t> sumV(n + 1, 0);
  for (int i = 0; i < n; ++i) {
    sumV[i + 1] = sumV[i] + a[i];
  }
  int res = 0;
  for (int i = 0; i < n + 1; ++i) {
    for (int j = i + 1; j < n + 1; ++j) {
      if (sumV[j] - sumV[i] == 0) {
        res++;
      }
    }
  }
  cout << res << endl;
}
