#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int MAX = 2e3 + 5;
const long long MAX2 = 11;
const long long MOD = 998244353;
const long long MOD2 = 1000005329;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 2000;
int n, x[23], uj, msk, ans;
vector<int> av[23][23];
bool dp[2][1 << 23], nw, ls, st;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  --n;
  for (int i = 0; i <= n; ++i) cin >> x[i];
  for (int i = 1; i <= n; ++i) {
    st = 0;
    for (int j = 0; j <= i; ++j)
      for (int k = j; k <= i; ++k)
        if (x[j] + x[k] == x[i]) av[i][j].push_back(1 << k), st = 1;
    if (!st) return cout << "-1\n", 0;
  }
  dp[0][1] = 1;
  nw = 1;
  for (int i = 1; i <= n; ++i) {
    uj = 1 << i;
    for (int mask = 1; mask <= 8388607; ++mask) {
      if (!dp[ls][mask]) continue;
      st = 0;
      for (int k = 0; k < i; ++k) {
        if (av[i][k].empty() || (mask & (1 << k)) == 0) continue;
        for (int o : av[i][k]) {
          if (mask & o) {
            st = 1;
            break;
          }
        }
        if (st) break;
      }
      if (!st) continue;
      msk = mask | uj;
      if (__builtin_popcount(mask) < 8) dp[nw][msk] = 1;
      for (int k = 1; k < uj; k <<= 1) {
        if (msk & k) dp[nw][msk ^ k] = 1;
      }
    }
    memset(dp[ls], 0, sizeof dp[ls]);
    ls ^= 1, nw ^= 1;
  }
  ans = n + 1;
  for (int mask = 1; mask <= 8388607; ++mask) {
    if (dp[ls][mask]) ans = min(ans, __builtin_popcount(mask));
  }
  cout << ans << '\n';
  return 0;
}
