#include <bits/stdc++.h>
using namespace std;
int can_make[1 << 23], a[23];
int dp[1 << 23], last[1 << 23];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      for (int k = 0; k < n; ++k)
        if (a[i] + a[j] == a[k]) can_make[(1 << i) | (1 << j)] |= 1 << k;
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 0; j < n; ++j) {
      if (i & (1 << j)) {
        can_make[i] |= can_make[i ^ (1 << j)];
      }
    }
  }
  if (n == 1) {
    cout << "1\n";
    return 0;
  }
  dp[1] = 1;
  for (int j = 1; j < n; ++j) {
    swap(dp, last);
    for (int i = 0; i < (1 << j + 1); ++i) dp[i] = 100;
    for (int i = (1 << j); i < (1 << (j + 1)); ++i) {
      if (i & (1 << j)) {
        if (can_make[i ^ (1 << j)] & (1 << j)) {
          int tmp = last[i ^ (1 << j)] + 1;
          if (tmp < 100) {
            dp[i] = min(dp[i], tmp);
            for (int k = 0; k < j; ++k) {
              if (i & (1 << k)) {
                dp[i ^ (1 << k)] = min(dp[i ^ (1 << k)], last[i ^ (1 << j)]);
              }
            }
          }
        }
      }
    }
  }
  int ans = 100;
  for (int i = 0; i < (1 << n); ++i) {
    ans = min(ans, dp[i]);
  }
  if (ans < 100)
    cout << (int)ans << '\n';
  else
    cout << "-1\n";
}
