#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> v(n + 1);
  v[0] = 0;
  long long in, sum = 0;
  long long ans = 0;
  long long k;
  for (long long i = 0; i < n; ++i) {
    cin >> in;
    sum += in;
    v[i + 1] = sum;
    for (k = 0; k < i; ++k) {
      if (sum - v[k] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
