#include <bits/stdc++.h>
using namespace std;
int n;
map<int, int> mapa;
int tab[30];
vector<int> pary[30];
bool dp[1 << 24];
string conv(int x) {
  string res;
  while (x) {
    if (x & 1)
      res += '1';
    else
      res += '0';
    x >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tab[i];
    mapa[tab[i]] = i;
  }
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++)
      if (mapa.find(tab[i] + tab[j]) != mapa.end())
        pary[mapa[tab[i] + tab[j]]].push_back((1 << i) | (1 << j));
  for (int i = 1; i < n; i++)
    if (pary[i].empty()) {
      cout << "-1\n";
      exit(0);
    }
  dp[1] = 1;
  for (int i = 1; i < n; i++) {
    int maska = 1 << i;
    for (int j = 1; j < (1 << i); j++) {
      if (!(j & (1 << (i - 1))) || !dp[j]) continue;
      for (auto m : pary[i])
        if ((m & j) == m) {
          int t = j | maska;
          dp[t] = true;
          for (int k = 0; k < i; k++)
            if (t & (1 << k)) {
              dp[t ^ (1 << k)] = true;
            }
        }
    }
  }
  int res = 100;
  for (int i = (1 << (n - 1)); i < (1 << n); i++)
    if (dp[i]) res = min(res, __builtin_popcount(i));
  cout << (res == 100 ? -1 : res) << "\n";
  return 0;
}
