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