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