#include <bits/stdc++.h>
using namespace std;
int dp[1 << 23];
vector<pair<int, int> > p[23];
int a[100];
int main() {
  int n, res = 1000;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < i; j++)
      for (int k = j; k < i; k++)
        if (a[j] + a[k] == a[i]) p[i].push_back(make_pair(j, k));
  }
  memset(dp, 125, sizeof(dp));
  dp[1] = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < (1 << (i - 1)); j++) {
      int jj = j | (1 << (i - 1));
      for (int k = 0; k < p[i].size(); k++) {
        int a = p[i][k].first, b = p[i][k].second;
        if (!(jj & (1 << a)) || !(jj & (1 << b))) continue;
        int msk = jj | (1 << i);
        dp[msk] = min(dp[msk], dp[jj] + 1);
        for (int del = 0; del < i; del++)
          if (msk & (1 << del))
            dp[msk ^ (1 << del)] = min(dp[msk ^ (1 << del)], dp[jj]);
      }
    }
  }
  for (int i = 0; i < 1 << n; i++)
    if ((i & (1 << (n - 1)))) res = min(res, dp[i]);
  cout << (res == 1000 ? -1 : res) << endl;
  return 0;
}
