#include <bits/stdc++.h>
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double EPS = 0.001;
const long double EPS2 = 1e-6;
const long double PI = acos(-1);
const int MOD7 = 1000000007;
const int MOD9 = 1000000009;
const int a228 = 18;
const int inf = 1e9;
const long long kekmod = 1791791791;
const long long bestmod = 1148822869;
const long long INF = 4e18;
const int mod = 1000000009;
const int MAXN = (1 << 23) + 228;
int ppc[MAXN];
bool dp[MAXN];
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  for (int i = 1; i < MAXN; ++i) ppc[i] = ppc[i >> 1] + (i & 1);
  int n;
  cin >> n;
  vector<int> a(n);
  for (long long i = 0; i < a.size(); ++i) cin >> a[i];
  ;
  dp[1] = 1;
  int ans = 228;
  for (int mask = 0; mask < (1 << n); ++mask) {
    if (!dp[mask]) continue;
    if (mask & (1 << (n - 1))) {
      ans = min(ans, ppc[mask]);
      continue;
    }
    int mxbt = 0;
    for (int i = 0; i < n; ++i) {
      if (mask & (1 << i)) mxbt = i;
    }
    for (int bt = 0; bt < n; ++bt) {
      if (!(mask & (1 << bt))) continue;
      for (int j = bt; j < n; ++j) {
        if (!(mask & (1 << j))) continue;
        if (a[bt] + a[j] == a[mxbt + 1]) {
          dp[mask | (1 << (mxbt + 1))] = 1;
          for (int j = 0; j < n; ++j) {
            if (mask & (1 << j)) {
              dp[mask ^ (1 << j) | (1 << (mxbt + 1))] = 1;
            }
          }
        }
      }
    }
  }
  if (ans == 228) {
    cout << -1;
    return 0;
  }
  cout << ans;
}
