#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j;
  long long k = 0;
  cin >> n;
  vector<long long> a(n + 1);
  vector<long long> b(n + 2);
  for (i = 0; i < n; i = i + 1) {
    cin >> a.at(i);
    b.at(i + 1) = b.at(i) + a.at(i);
  }
  for (i = 0; i < n + 1; i = i + 1) {
    for (j = i + 1; j < n + 1; j = j + 1) {
      if (b.at(i) == b.at(j)) k += 1;
    }
  }
  cout << k << endl;
  return 0;
}
