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