#include <bits/stdc++.h>
using namespace std;
int a[24], n, n2, ans = 30, v[1 << 24];
int d[1 << 24];
bool cmp(int x, int y) { return a[x] < a[y]; }
int on_bit(int x) { return x ? 1 + on_bit(x - (x & -x)) : 0; }
int dfs(int state, int e) {
  int res = 30;
  if (e == 1) return d[state] = 1;
  if (d[state]) return d[state];
  int bit = on_bit(state);
  for (int i = 0; i < e; i++)
    for (int j = 0; j <= i; j++)
      if (a[i] + a[j] == a[e]) {
        int t =
            dfs(state & ~(1 << e) | (1 << e - 1) | (1 << i) | (1 << j), e - 1);
        res = min(res, max(bit, t));
      }
  return d[state] = res;
}
int main() {
  cin >> n;
  n++;
  for (int i = 1; i < n; i++) cin >> a[i];
  ans = dfs(1 << n - 1, n - 1);
  if (ans == 30)
    cout << -1 << '\n';
  else
    cout << ans << '\n';
  return 0;
}
