#include <bits/stdc++.h>
using namespace std;
int n, a[111], f[(1 << (23))], x[33];
int main() {
  while (cin >> n) {
    for (int i = 0, _a = (n); i < _a; i++) cin >> a[i];
    if (n == 1) {
      cout << 1 << endl;
      continue;
    }
    int res = n + 1;
    for (int S = 0, _a = ((1 << (n))); S < _a; S++) f[S] = n + 1;
    f[1] = 1;
    for (int S = (1), _b = ((1 << (n)) - 2); S <= _b; S++) {
      int last = -1;
      for (int i = (n - 1), _b = (0); i >= _b; i--)
        if ((S & (1 << (i)))) {
          last = i;
          break;
        }
      int cur = f[S];
      if (last == n - 1) {
        res = min(res, cur);
        continue;
      }
      int next = last + 1;
      bool ok = false;
      int nx = 0;
      for (int i = 0, _a = (n); i < _a; i++)
        if ((S & (1 << (i)))) x[++nx] = a[i];
      sort(x + 1, x + nx + 1);
      int j = nx, i = 1;
      while (i <= j) {
        if (x[i] + x[j] == a[next]) {
          ok = true;
          break;
        } else if (x[i] + x[j] > a[next]) {
          --j;
        } else
          ++i;
      }
      if (!ok) continue;
      int S2 = S | (1 << (next));
      f[S2] = min(f[S2], max(cur, __builtin_popcount(S2)));
      for (int i = 0, _a = (n); i < _a; i++)
        if ((S & (1 << (i)))) {
          S2 = S - (1 << (i)) + (1 << (next));
          f[S2] = min(f[S2], max(cur, __builtin_popcount(S2)));
        }
    }
    if (res > n)
      cout << -1 << endl;
    else
      cout << res << endl;
  }
  return 0;
}
