#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t N, res = 0, c = 0;
  cin >> N;
  vector<int64_t> A(N), T(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  T[0] = A[0];
  for (int i = 1; i < N; i++) {
    T[i] += T[i - 1] + A[i];
    if (T[i] == 0) res++;
  }
  for (int s = 1; s < N - 1; s++) {
    c += A[s - 1];
    for (int e = s + 1; e < N; e++) {
      if (T[e] == c) {
        res++;
      } else if (T[e] > c) {
        break;
      }
    }
  }
  cout << res << endl;
}
