#include <bits/stdc++.h>
using namespace std;
const int maxn = 23;
int Q[2][1 << (maxn - 1)], L[2];
int n, a[maxn];
short idx[1 << maxn];
short ms[2][1 << maxn];
vector<vector<pair<int, int> > > ret;
short cnt[1 << maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int tot = 1 << n;
  for (int s = 1; s < tot; ++s) {
    cnt[s] = cnt[s >> 1] + (s & 1);
  }
  ret.resize(n + 1);
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < i; ++j) {
      for (int k = j; k < i; ++k) {
        if (a[i] == a[j] + a[k]) {
          ret[i].push_back(make_pair(j, k));
        }
      }
    }
    if (!ret[i].size()) {
      puts("-1");
      return 0;
    }
  }
  L[0] = L[1] = 0;
  int pre = 0, cur = 1;
  Q[0][L[0]++] = 1;
  ms[0][1] = 1;
  for (int i = 1; i < n; ++i) {
    L[cur] = 0;
    for (int l = 0; l < L[pre]; ++l) {
      int ns = Q[pre][l] ^ (1 << i);
      for (int s = 0; s < ret[i].size(); ++s) {
        if ((ns & (1 << ret[i][s].first)) && (ns & (1 << ret[i][s].second))) {
          if (idx[ns] != i) {
            idx[ns] = i;
            Q[cur][L[cur]++] = ns;
          }
          for (int u = 0; u < i; ++u) {
            if (ns & (1 << u)) {
              if (idx[ns ^ (1 << u)] != i) {
                idx[ns ^ (1 << u)] = i;
                Q[cur][L[cur]++] = ns ^ (1 << u);
              }
            }
          }
        }
      }
    }
    swap(pre, cur);
  }
  short result = n;
  for (int i = 0; i < L[pre]; ++i) {
    int s = Q[pre][i];
    short cnt = 0;
    for (; s; s -= s & -s) ++cnt;
    result = min(result, cnt);
  }
  printf("%d\n", (int)result);
  return 0;
}
