#include <bits/stdc++.h>
using namespace std;
template <class X>
void pr(X test) {
  cout << test << endl;
}
template <class X>
void prr(X test) {
  for (auto it : test) {
    cout << it;
  }
  cout << endl;
}
int main() {
  long long n, c;
  cin >> n;
  vector<long long> v(n);
  vector<long long> sum(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  long long sss = 0;
  for (long long i = 0; i < n; i++) {
    sss += v[i];
    sum[i] = sss;
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++)
    for (long long j = i + 1; j < n; j++) {
      if (i == 0) {
        if (sum[j] == 0) ans++;
      } else {
        if (sum[i - 1] == sum[j]) ans++;
      }
    }
  pr(ans);
}
