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