#include <bits/stdc++.h>
using namespace std;
const int L = 1 << 24, N = 24;
int n;
int a[N];
int ps[N][N];
map<int, int> mp;
bitset<L> dp[N];
int cnt[L];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int i = 0; i < n; ++i) {
    mp[a[i]] = i;
  }
  memset(ps, -1, sizeof(ps));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      if (mp.count(a[i] - a[j])) {
        int t = mp[a[i] - a[j]];
        if (t < i) ps[i][j] = t;
      }
    }
  }
  cnt[0] = 0;
  for (int i = 1; i < 1 << n; ++i) {
    cnt[i] = cnt[i - (i & -i)] + 1;
  }
  dp[0][1] = 1;
  for (int i = 1; i < n; ++i) {
    for (int msk = 0; msk < 1 << i; ++msk)
      if (dp[i - 1][msk]) {
        bool ok = 0;
        for (int j = 0; j < i && !ok; ++j) {
          if (msk & (1 << j)) {
            int t = ps[i][j];
            if (t != -1 && (msk & (1 << t))) {
              ok = 1;
            }
          }
        }
        if (ok) {
          dp[i][msk | (1 << i)] = 1;
          for (int j = 0; j < i; ++j)
            if (msk & (1 << j)) {
              dp[i][(msk - (1 << j)) | (1 << i)] = 1;
            }
        }
      }
  }
  int ans = n + 1;
  for (int msk = 0; msk < 1 << n + 1; ++msk)
    if (dp[n - 1][msk]) {
      ans = min(cnt[msk], ans);
    }
  printf("%d\n", ans > n ? -1 : ans);
  return 0;
}
