#include <bits/stdc++.h>
using namespace std;
int nextInt() {
  int d;
  scanf("%d", &d);
  return d;
};
int n;
const int cMaxNum = 23;
const int maxSize = 1 << cMaxNum;
long a[cMaxNum];
int ma[maxSize];
int mb[maxSize];
int *curDp, *nextDp;
vector<int> submasks[cMaxNum];
int bC(int i) {
  i = i - ((i >> 1) & 0x55555555);
  i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
  i = (i + (i >> 4)) & 0x0f0f0f0f;
  i = i + (i >> 8);
  i = i + (i >> 16);
  return i & 0x3f;
}
int bitCount(int first) {
  return (first & 1) + (first ? bitCount(first / 2) : 0);
}
int main() {
  n = nextInt();
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++)
        if (a[k] == a[i] + a[j]) submasks[k].push_back((1 << i) | (1 << j));
  curDp = ma;
  nextDp = mb;
  curDp[1] = 1;
  for (int i = 1; i < n; i++) {
    for (int startMask = 1; startMask < (1 << i); startMask++) {
      if (!curDp[startMask]) continue;
      bool ok = false;
      for (unsigned int z = 0; z < submasks[i].size(); z++) {
        if ((startMask & submasks[i][z]) == submasks[i][z]) {
          ok = true;
          break;
        }
      }
      if (ok) {
        for (int inst = 0; inst <= i; inst++) {
          if ((startMask & (1 << inst)) != 0) {
            int newMask = (startMask ^ (1 << inst)) | (1 << i);
            int val = bC(newMask);
            if (nextDp[newMask] == 0 || nextDp[newMask] > val)
              nextDp[newMask] = val;
          }
        }
        int newMask = startMask | (1 << i);
        int val = bC(newMask);
        if (nextDp[newMask] == 0 || nextDp[newMask] > val)
          nextDp[newMask] = val;
      }
    }
    int *tmp = curDp;
    curDp = nextDp;
    nextDp = tmp;
    memset(nextDp, 0, maxSize * sizeof(int));
  }
  int ret = 1000;
  for (int m = 0; m < (1 << n); m++)
    if (curDp[m] != 0) ret = min(ret, curDp[m]);
  if (ret == 1000) ret = -1;
  printf("%d\n", ret);
  return 0;
}
