#include <bits/stdc++.h>
using namespace std;
int main() {
  int longs, sum = 0, zerosum = 0;
  cin >> longs;
  vector<int> sums(longs);
  for (int i = 0; i < longs; i++) {
    int number;
    cin >> number;
    sum += number;
    sums.at(i) = sum;
  }
  for (int i : sums) {
    for (int j : sums) {
      if (i == j) {
        zerosum++;
      }
    }
  }
  cout << zerosum - longs << endl;
}
