#include <bits/stdc++.h>
using namespace std;
const int maxN = 23;
const int mod = 1000 * 1000 * 1000 + 7;
int dp[2][1 << maxN];
int a[maxN];
int res[maxN][maxN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[0][1] = 1;
  dp[0][0] = mod;
  memset(res, -1, sizeof res);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++)
      for (int k = 0; k < i; k++)
        if (a[j] + a[k] == a[i]) res[i][j] = k;
  for (int i = 1; i < n; i++) {
    int u = i & 1;
    for (int mask = 0; mask < (1 << (i + 1)); mask++) dp[u][mask] = mod;
    for (int mask = 0; mask < (1 << i); mask++) {
      for (int j = 0; j < i; j++) {
        if (res[i][j] == -1) continue;
        if (mask >> j & 1)
          if (mask >> res[i][j] & 1) {
            int tmp = mask ^ (1 << i);
            dp[u][tmp] =
                min(dp[u][tmp], max(__builtin_popcount(tmp), dp[!u][mask]));
            for (int k = 0; k < i; k++) {
              if (mask >> k & 1) {
                dp[u][tmp ^ (1 << k)] =
                    min(dp[u][tmp ^ (1 << k)], dp[!u][mask]);
              }
            }
            break;
          }
      }
    }
  }
  int ans = mod;
  for (int mask = 0; mask < (1 << n); mask++)
    ans = min(ans, dp[(n - 1) & 1][mask]);
  if (ans == mod)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
