#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
int n, a[33];
vector<pair<int, int> > e[33];
bool used[1 << 23];
int q[1 << 23], head, tail;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    for (int j = 0; j < i; ++j) {
      for (int k = j; k < i; ++k)
        if (a[j] + a[k] == a[i]) {
          e[i].push_back(make_pair(j, k));
        }
    }
  }
  used[1] = true;
  q[tail++] = 1;
  int res = inf;
  while (head < tail) {
    int mask = q[head++];
    int gr = -1;
    for (int i = 0; i < n; ++i)
      if (mask & (1 << i)) gr = i;
    if (gr == n - 1) {
      res = min(res, __builtin_popcount(mask));
      continue;
    }
    int j = gr + 1;
    bool ok = false;
    for (__typeof(e[j].begin()) it = e[j].begin(); it != e[j].end(); ++it) {
      int &k = (*it).first, &l = (*it).second;
      if ((mask & (1 << k)) && (mask & (1 << l))) {
        ok = true;
        break;
      }
    }
    if (!ok) continue;
    for (int i = 0; i < j; ++i)
      if (mask & (1 << i)) {
        int nm = (mask ^ (1 << i)) | (1 << j);
        if (!used[nm]) {
          used[nm] = true;
          q[tail++] = nm;
        }
      }
    if (!used[mask | (1 << j)]) {
      used[mask | (1 << j)] = true;
      q[tail++] = mask | (1 << j);
    }
  }
  if (res < inf)
    printf("%d\n", res);
  else
    puts("-1");
}
