#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long data = 0, w = 1;
  char ch = 0;
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') w = -1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    data = (data << 1) + (data << 3) + (ch ^ 48), ch = getchar();
  return data * w;
}
long long n, a[2200005], sum[2200005];
bool ok[2200005];
int ans[2200005], size[2200005];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    if (!a[i]) n--, i--;
  }
  int bs = (1 << n) - 1;
  for (int i = 0; i <= bs; i++)
    for (int j = 0; j <= n - 1; j++)
      if (i >> j & 1) sum[i] += a[j + 1];
  for (int i = 1; i <= bs; i++) {
    size[i] = size[i - (i & -i)] + 1;
    for (int j = (i - 1) & i; j << 1 >= i; j = (j - 1) & i)
      if (abs(sum[i ^ j] - sum[j]) < size[i] && (sum[i] + size[i] & 1)) {
        ok[i] = 1;
        break;
      }
  }
  for (int i = 1; i <= bs; i++)
    if (ok[i]) {
      int k = bs ^ i;
      ans[i] = max(ans[i], 1);
      for (int j = k; j; j = (j - 1) & k)
        ans[i | j] = max(ans[i | j], ans[j] + 1);
    }
  int mx = 0;
  for (int i = 0; i <= bs; i++) mx = max(mx, ans[i]);
  cout << n - mx << '\n';
  return 0;
}
