#include <bits/stdc++.h>
using std::cerr;
using std::endl;
const int N = 20;
int n, m, all;
long long A[N + 1], B[N + 1];
long long val[(1 << N) + 5];
int f[(1 << N) + 5];
inline int check(int S) {
  m = 0;
  long long sum = 0;
  for (int i = 1; i <= n; ++i)
    if (S & (1 << (i - 1)))
      B[m++] = A[i], sum += A[i], val[(1 << (m - 1))] = A[i];
  if ((sum - m + 1) & 1) return 0;
  for (int s = 1; s < 1 << m; ++s) {
    val[s] = val[s & -s] + val[s ^ (s & -s)];
  }
  for (int s = 1; s + 1 < 1 << m; ++s) {
    long long tmp = val[s] - val[((1 << m) - 1) ^ s];
    if (std::abs(tmp) < m) return 1;
  }
  return 0;
}
int main() {
  std::cin >> n;
  for (int i = 1; i <= n; ++i) {
    std::cin >> A[i];
    if (A[i]) A[++m] = A[i];
  }
  n = m, all = (1 << n) - 1;
  for (int s = 1; s <= all; ++s) {
    if (!f[s] && check(s)) {
      f[s] = 1;
      for (int t = all ^ s; t; t = (t - 1) & (all ^ s)) {
        f[s | t] = std::max(f[s | t], f[t] + 1);
      }
    }
  }
  std::cout << n - f[all] << std::endl;
  return 0;
}
