#include <bits/stdc++.h>
using namespace std;
int arr[30];
vector<pair<int, int> > canbe[30];
int N;
int nowmin;
set<int> st;
long long hsh(vector<int> vp, int d) {
  sort(vp.begin(), vp.end());
  long long ans = 0;
  vp.push_back(vp.size());
  for (int i = 0; i < vp.size(); i++) {
    ans *= 1311337;
    ans += vp[i];
  }
  return ans;
}
void dfs(int v, int depth) {
  int l = __builtin_popcount(v);
  if (l >= nowmin) return;
  if (st.count(v)) return;
  st.insert(v);
  if (l >= nowmin) return;
  bool canu = false;
  for (int i = 0; i < canbe[depth].size(); i++) {
    int x = canbe[depth][i].first, y = canbe[depth][i].second;
    if (((1 << x) & v) && ((1 << y) & v)) {
      canu = true;
      break;
    }
  }
  if (canu) {
    if (depth == N - 1) {
      nowmin = min(nowmin, l);
      return;
    }
    for (int i = 0; i < depth; i++) {
      if ((1 << i) & v) {
        int q = (v & ~(1 << i)) | (1 << depth);
        dfs(q, depth + 1);
      }
    }
    int z = v | (1 << depth);
    dfs(z, depth + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> arr[i];
  }
  for (int k = 1; k < N; k++) {
    for (int i = 0; i < k; i++) {
      for (int j = 0; j <= i; j++) {
        if (arr[i] + arr[j] == arr[k]) {
          canbe[k].push_back(make_pair(j, i));
        }
      }
    }
  }
  nowmin = 12345;
  if (N == 1)
    nowmin = 1;
  else
    dfs(1, 1);
  cout << (nowmin == 12345 ? -1 : nowmin) << endl;
  return 0;
}
