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