#include <bits/stdc++.h>
using namespace std;
int dp[(1 << 23) + 10], a[25], n;
vector<int> pairs[25];
int f(int mask, int idx) {
  int& ret = dp[mask];
  if (idx == n) {
    return __builtin_popcount(mask);
  }
  if (~ret) {
    return ret;
  }
  ret = 50;
  int target = a[idx];
  bool ok = false;
  for (int pairSum : pairs[idx]) {
    if ((pairSum & mask) == pairSum) {
      ok = true;
      break;
    }
  }
  if (ok) {
    ret = min(ret, f(mask | (1 << idx), idx + 1));
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        ret = min(ret, f((mask - (1 << i)) | (1 << idx), idx + 1));
      }
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  memset(dp, -1, sizeof dp);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int idx = 0; idx < n; idx++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (a[i] + a[j] == a[idx]) {
          pairs[idx].push_back((1 << i) | (1 << j));
        }
      }
    }
  }
  cout << (f(1, 1) < 50 ? f(1, 1) : -1) << "\n";
}
