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