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