#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(16);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<long long> csa(n + 1);
  csa[0] = 0;
  for (long long i = 0; i < n; i++) csa[i + 1] = csa[i] + a[i];
  long long count = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j <= n; j++) {
      const long long b = csa[j] - csa[i];
      if (b == 0) count++;
    }
  }
  cout << count << endl;
}
