#include <bits/stdc++.h>
using namespace std;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n + 1);
  vector<int> X(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    X[i] = X[i - 1] + a[i];
  }
  sort(X.begin(), X.end());
  int ans = 0;
  for (int i = 0; i < X.size(); ++i) {
    for (int j = i + 1; j < X.size(); ++j) {
      if (X[i] == X[j]) ++ans;
    }
  }
  cout << ans << "\n";
  return 0;
}
