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