#include <bits/stdc++.h>
using namespace std;
const int maxn = 30;
bool d[(1 << 23) + 100];
int n, a[maxn], tol[maxn][maxn];
int main() {
  ios_base::sync_with_stdio(false);
  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]) tol[i][k] += 1 << j;
  d[1] = true;
  for (int mask = 0; mask < (1 << n - 1); mask++)
    if (d[mask]) {
      int last = 0;
      for (int i = 0; i < n; i++)
        if (mask & (1 << i)) last = i + 1;
      bool pos = false;
      for (int i = 0; i < n; i++)
        if (mask & (1 << i))
          if (mask & tol[i][last]) pos = true;
      if (pos) {
        for (int i = 0; i < n; i++)
          if (mask & (1 << i)) d[mask ^ (1 << i) ^ (1 << last)] = true;
        d[mask ^ (1 << last)] = true;
      }
    }
  int ans = 100;
  for (int i = (1 << n - 1); i < (1 << n); i++)
    if (d[i]) ans = min(ans, __builtin_popcount(i));
  if (ans == 100)
    cout << "-1" << endl;
  else
    cout << ans << endl;
  return 0;
}
