#include <bits/stdc++.h>
using namespace std;
const int P = 1 << 20, Q = 55;
void FWT(int a[], int n, int ty) {
  for (int m = 1; m < n; m <<= 1)
    for (int i = 0; i < n; i += (m << 1))
      for (int j = 0; j < m; j++)
        a[i + j + m] += ty == 1 ? a[i + j] : (-a[i + j]);
}
int bs[P];
long long sm[P], a[Q];
long long a1[P], a2[P];
int ok[P];
int f[P];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]), sm[1 << i] = a[i];
  for (int i = 1; i < (1 << n); i++)
    sm[i] = sm[((i) & (-i))] + sm[i ^ ((i) & (-i))],
    bs[i] = bs[i >> 1] + (i & 1);
  for (int i = 0; i < (1 << n); i++) {
    if (bs[i] == 1 && sm[i] == 0) ok[i] = 1;
    if (bs[i] < 2 || (sm[i] + bs[i]) % 2LL == 0) continue;
    long long val, lim = bs[i];
    for (int j = (i - 1) & i; j; j = (j - 1) & i)
      if ((val = sm[i] - (sm[j] << 1)) >= 0 && sm[i] - (sm[j] << 1) <= lim) {
        ok[i] = 1;
        break;
      }
  }
  int als = 0;
  for (int i = 1; i < (1 << n); i++) {
    for (int j = (i - 1) & i; j; j = (j - 1) & i)
      ok[i] = max(ok[i], ok[j] + ok[i ^ j]);
    als = max(als, ok[i]);
  }
  printf("%d\n", n - als);
  return 0;
}
