#include <bits/stdc++.h>
using namespace std;
const int maxn = 20;
inline int gi() {
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int sum = 0;
  while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
  return sum;
}
inline void chkmax(int &a, int b) {
  if (a < b) a = b;
}
int n;
long long a[maxn], sum[1 << maxn], Log[1 << maxn];
int chk[1 << maxn], siz[1 << maxn], f[1 << maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld", &a[i]), Log[1 << i] = i;
    if (!a[i]) --i, --n;
  }
  for (int i = 1; i < (1 << n); ++i)
    sum[i] = sum[i ^ (i & (-i))] + a[Log[i & (-i)]];
  for (int i = 0; i < (1 << n); ++i) {
    siz[i] = siz[i >> 1] + (i & 1);
    if (siz[i] == 1) continue;
    for (int j = (i - 1) & i; (2 * j >= i) && j; j = (j - 1) & i)
      if (abs(sum[j] - sum[i ^ j]) < siz[i] &&
          (abs(sum[j] - sum[i ^ j]) & 1) != (siz[i] & 1)) {
        chk[i] = 1;
        break;
      }
  }
  for (int i = 1; i < (1 << n); ++i)
    if (chk[i]) {
      int k = ((1 << n) - 1) ^ i;
      f[i] = max(f[i], 1);
      for (int j = k; j; j = (j - 1) & k) chkmax(f[i | j], f[j] + 1);
    }
  int ans = 0;
  for (int i = 0; i < (1 << n); ++i) chkmax(ans, f[i]);
  printf("%d\n", n - ans);
  return 0;
}
