#include <bits/stdc++.h>
using namespace std;
int arr[24];
int n;
int memo[(1 << 22) + 5];
vector<int> msk[24];
int solve(int v, int idx) {
  if (idx == n) return 0;
  int &res = memo[v];
  if (~res) return res;
  res = 1e9;
  bool c = 0;
  for (auto &x : msk[idx]) {
    if ((v & x) == x) {
      c = 1;
      break;
    }
  }
  if (!c) return res;
  res = min(res, 1 + solve(v | (1 << idx), idx + 1));
  for (int i = 0; i < idx; ++i) {
    if ((v >> i) & 1) {
      res = min(res, solve((v | (1 << idx)) ^ (1 << i), idx + 1));
    }
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", arr + i);
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      for (int k = 0; k < i; ++k) {
        if (arr[j] + arr[k] == arr[i]) {
          msk[i].push_back((1 << j) | (1 << k));
        }
      }
    }
  }
  memset(memo, -1, sizeof memo);
  int v = 1 + solve(1, 1);
  if (v <= n)
    printf("%d", v);
  else
    puts("-1");
}
