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