#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1000, Maxm = 200000, oo = INT_MAX >> 2;
int deep;
int n, ans, a[Maxn], vis[1 << 24];
bitset<24> flag;
int dfs(int p, bitset<24> flag) {
  int t = flag.to_ulong(), q = flag.count();
  if (vis[t]) return vis[t];
  if (q > 8) return oo;
  if (p == n + 1) {
    ans = min(ans, q);
    return ans;
  }
  flag[p] = 1;
  int check = 0;
  for (int i = 1; i < p; i++)
    for (int j = 1; j <= i; j++)
      check = check || (flag[i] && flag[j] && a[i] + a[j] == a[p]);
  if (!check) return vis[t] = oo;
  int tmp = dfs(p + 1, flag);
  for (int k = 1; k < p; k++)
    if (flag[k]) {
      flag[k] = 0;
      tmp = min(tmp, dfs(p + 1, flag));
      flag[k] = 1;
    }
  return vis[t] = tmp;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  flag[1] = 1;
  ans = oo;
  dfs(2, flag);
  if (ans == oo)
    cout << -1 << endl;
  else
    cout << ans << endl;
}
