#include <bits/stdc++.h>
using namespace std;
int in[25];
int n;
bool ty[23][1 << 23];
int pp[25][25];
void pre() {
  for (int a = (0); a < int(n); a += 1)
    for (int b = (0); b < int(n); b += 1)
      for (int c = (0); c < int(n); c += 1) {
        if (in[a] == in[b] + in[c]) pp[a][b] = c;
      }
  for (int ox = (1); ox < int(n); ox += 1)
    for (int msk = (1); msk < int(1 << ox); msk += 1) {
      for (int a = (0); a < int(n); a += 1) {
        if (!(msk & (1 << a))) continue;
        int b = pp[ox][a];
        if (!(msk & (1 << b))) continue;
        if (in[a] + in[b] == in[ox]) {
          ty[ox][msk] = 1;
          goto next;
        }
      }
    next:
      NULL;
    }
}
bool dp[1 << 23];
bool chk(int sz) {
  memset(dp, 0, sizeof(dp));
  dp[1] = 1;
  bool ret = 0;
  int last = 0;
  for (int msk = (1); msk < int(1 << n); msk += 1) {
    if (dp[msk] == 0) continue;
    while (msk >= (1 << last)) last++;
    last--;
    if (ty[last + 1][msk] == 0) continue;
    if (last == (n - 2)) return 1;
    bool ki = __builtin_popcount(msk) < sz;
    int to = 1 << (last + 1);
    if (ki)
      dp[msk | to] = 1;
    else {
      for (int x = (0); x < int(last + 1); x += 1)
        if (msk & (1 << x)) dp[(msk ^ (1 << x)) | to] = 1;
    }
  }
  return ret;
}
int main() {
  cin >> n;
  in[0] = 0;
  for (int i = (0); i < int(n); i += 1) scanf("%d", in + i);
  for (int a = (1); a < int(n); a += 1) {
    bool ki = 0;
    for (int i = (0); i < int(a); i += 1)
      for (int j = (0); j < int(a); j += 1) ki |= ((in[i] + in[j]) == in[a]);
    if (!ki) {
      cout << -1;
      return 0;
    }
  }
  if (n == 1) {
    cout << 1;
    return 0;
  }
  pre();
  int s = 1, e = n, mid;
  int last = 0;
  while (s <= e) {
    mid = (s + e) >> 1;
    if (chk(mid))
      last = mid, e = mid - 1;
    else
      s = mid + 1;
  }
  assert(last);
  cout << last << endl;
  return 0;
}
