#include <bits/stdc++.h>
using namespace std;
const long long MXN = 23 + 10;
const long long MXM = (1LL << 23) + 10;
long long n, x, y, ans = 1e18;
long long A[MXN];
bitset<MXM> dp[MXN];
vector<pair<long long, long long>> Mk[MXN];
void Upd(long long i, long long mask, long long mask2) {
  for (int j = 0; j < i; j++)
    dp[i][mask] = dp[i][mask] | dp[i - 1][mask2 | (1LL << j)];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      for (int h = j + 1; h < n; h++) {
        if (A[i] + A[j] == A[h]) {
          Mk[h].emplace_back(i, j);
        }
      }
    }
  }
  dp[1][1] = 1;
  for (int i = 2; i <= n; i++) {
    for (int mask = 1; mask < (1LL << i); mask++) {
      if (!((mask >> (i - 1)) & 1LL)) continue;
      for (auto Pr : Mk[i - 1]) {
        tie(x, y) = Pr;
        if (!((mask >> x) & 1LL) && !((mask >> y) & 1LL) && x != y) continue;
        int mask2 = ((mask - (1LL << (i - 1))) | (1LL << x)) | (1LL << y);
        dp[i][mask] = dp[i][mask] | dp[i - 1][mask2];
        if (((mask >> x) & 1LL) && ((mask >> y) & 1LL) && !dp[i][mask]) {
          Upd(i, mask, mask2);
        }
      }
    }
  }
  for (int mask = 0; mask < (1LL << n); mask++) {
    long long pc = __builtin_popcount(mask);
    if (dp[n][mask]) ans = min(ans, pc);
  }
  cout << (ans == 1e18 ? -1 : ans);
  return 0;
}
