#include <bits/stdc++.h>
using namespace std;
int n, res = 100, a[30], pos[30][30];
bool dp[23][1 << 23];
int main() {
  int i, j, k, cur, mask;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < n; ++j) {
      pos[i][j] = -1;
      for (k = 0; k < n; ++k) {
        if (a[j] + a[k] == a[i]) {
          pos[i][j] = k;
        }
      }
    }
  }
  dp[0][1] = true;
  for (i = 1; i < n; ++i) {
    for (mask = 1; mask < (1 << n); ++mask) {
      if (!dp[i - 1][mask]) {
        continue;
      }
      bool flag = false;
      for (j = 0; j < n; ++j) {
        if ((mask >> j) & 1) {
          k = pos[i][j];
          if (k == -1) {
            continue;
          }
          if ((mask >> k) & 1) {
            flag = true;
            break;
          }
        }
      }
      if (flag) {
        dp[i][mask + (1 << i)] = true;
        for (j = 0; j < n; ++j) {
          if ((mask >> j) & 1) {
            dp[i][mask + (1 << i) - (1 << j)] = true;
          }
        }
      }
    }
  }
  for (mask = 1; mask < (1 << n); ++mask) {
    if (!dp[n - 1][mask]) {
      continue;
    }
    cur = 0;
    for (j = 0; j < n; ++j) {
      if ((mask >> j) & 1) {
        ++cur;
      }
    }
    res = min(res, cur);
  }
  cout << (res == 100 ? -1 : res) << endl;
  return 0;
}
