#include <bits/stdc++.h>
using namespace std;
int a[23], n, n2, ans = 30, v[1 << 23];
bool d[1 << 23] = {true, true};
bool cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  n2 = 1 << n;
  d[1] = true;
  for (int i = 1; i < n2; i++)
    if (d[i]) {
      int l = 0;
      for (int j = 1, k = 0; j <= i; j <<= 1, k++)
        if (i & j) v[l++] = k;
      int t = v[l - 1] + 1;
      if (t == n)
        ans = min(ans, l);
      else {
        sort(v, v + l, cmp);
        for (int j = 0, k = l - 1; k >= 0 && j < l;) {
          if (a[v[j]] + a[v[k]] == a[t]) {
            int h = i + (1 << t);
            d[h] = true;
            for (int c = 0; c < l; c++) d[h - (1 << v[c])] = true;
            break;
          }
          while (j < l && a[v[j]] + a[v[k]] < a[t]) j++;
          while (k >= 0 && a[v[j]] + a[v[k]] > a[t]) k--;
        }
      }
    }
  if (ans == 30)
    cout << -1 << '\n';
  else
    cout << ans << '\n';
  return 0;
}
