#include <bits/stdc++.h>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
int n;
long long a[22], sum[1 << 21];
int f, g[1 << 21];
char lg[1 << 21], bt[1 << 21];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (!a[i]) i--, n--;
  }
  int st = clock();
  for (int i = 0; i <= 20; i++) lg[1 << i] = i;
  for (int s = 1; s < (1 << n); s++) {
    sum[s] = sum[s - (s & -s)] + a[lg[s & -s] + 1];
  }
  int tt = 0;
  for (int s = 1; s < (1 << n); s++) {
    int si = bt[s] = bt[s >> 1] + (s & 1), f = 0;
    for (int t = s & (s - 1); t * 2 >= s; t = (t - 1) & s) {
      long long tans = abs(sum[t] - sum[s - t]);
      if ((tans & 1) != (si & 1) && tans < si) {
        f = 1;
        break;
      }
    }
    if (f) {
      g[s] = max(g[s], 1);
      int em = (1 << n) - 1 - s;
      for (int t = em; t; t = (t - 1) & em) {
        g[s | t] = max(g[s | t], g[s] + g[t]);
      }
    }
    tt = max(tt, g[s]);
  }
  cout << n - tt << "\n";
  cerr << clock() - st;
  return 0;
}
