#include <bits/stdc++.h>
using namespace std;
const int i32INF = 1 << 30;
const long long i64INF = 1LL << 60;
const double mINF = 1e100;
const double EPS = 1e-9;
int nextint() {
  int a;
  scanf("%d", &a);
  return a;
}
int n;
vector<int> v;
int difs[23][23];
bool isGood[1 << 23];
bool solveIsGood(int mask) {
  int id = n;
  while ((mask & (1 << (id - 1))) == 0) id--;
  for (int i = 0; i < n; i++)
    if (mask & (1 << i) && mask & difs[id][i]) return true;
  return false;
}
int dp[1 << 23];
int main() {
  n = nextint();
  v.resize(n);
  for (int i = 0; i < n; i++) v[i] = nextint();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (i != j)
        for (int k = 0; k < n; k++)
          if (v[i] - v[j] == v[k]) difs[i][j] |= (1 << k);
  isGood[0] = 1;
  for (int mask = 1; mask < (1 << (n - 1)); mask++)
    isGood[mask] = solveIsGood(mask);
  fill(dp, dp + (1 << n), 1024);
  dp[1] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < (1 << (i - 1)); j++) {
      int jj = j | (1 << (i - 1));
      if (isGood[jj]) {
        int cr = dp[jj];
        jj |= 1 << i;
        dp[jj] = min(dp[jj], cr + 1);
        for (int k = 0; k < i; k++)
          if (jj & (1 << k))
            dp[jj & (~(1 << k))] = min(dp[jj & (~(1 << k))], cr);
      }
    }
  }
  int res = 1024;
  for (int mask = 0; mask < (1 << (n - 1)); mask++)
    res = min(res, dp[mask | (1 << (n - 1))]);
  if (res == 1024) res = -1;
  cout << res << endl;
  return 0;
}
