#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  cin >> n;
  vector<long> hai(n);
  int cnt = 0;
  long kari = 0;
  for (int i = 0; i < n; i++) cin >> hai[i];
  for (int i = 0; i < n - 1; i++) {
    kari = hai[i];
    for (int j = i + 1; j < n; j++) {
      if (hai[j] < 0) kari -= hai[j];
      if (hai[j] > 0) kari += hai[j];
      if (kari == 0) {
        cnt++;
        break;
      }
    }
  }
  cout << cnt << endl;
}
