#include <bits/stdc++.h>
using namespace std;
long long ans;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long lcm(long long x, long long y) { return x * y / gcd(x, y); }
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n + 1);
  a[0] = 0;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    a[i] = a[i - 1] + x;
  }
  for (long long i = 0; i <= n; i++) {
    for (long long j = i + 1; j <= n; j++) {
      if (a[j] - a[i] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
