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