#include <bits/stdc++.h>
using namespace std;
using pii = pair<long long, long long>;
long long a[200050];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long x;
  for (long long i = 1; i <= n; ++i) {
    cin >> x;
    a[i] = a[i - 1] + x;
  }
  long long cnt = 0;
  for (long long i = n; i > 0; --i) {
    for (long long j = i - 1; j >= 0; --j) {
      if (a[i] - a[j] == 0) ++cnt;
    }
  }
  cout << cnt << '\n';
  return 0;
}
