#include <bits/stdc++.h>
using namespace std;
const int sz = 1 << 23;
int can[sz];
int vis[sz];
int a[24];
int ax[24];
int has(int mm) {
  int ret = 0;
  for (int lw; lw = mm & (-mm), mm > 0; mm -= lw) ret++;
  return ret;
}
int pr(int cc) {
  for (int mm = 1; mm < (1 << 23); mm <<= 1) printf("%d", (cc & mm) ? 1 : 0);
  printf("\n");
}
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1) {
    printf("%d\n", 1);
    return 0;
  }
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int who = 1, mm = 2; who < n; mm <<= 1, who++) {
    for (int i = (mm >> 1); i < mm; i++) {
      int cnt = 0;
      for (int j = 0, mask = 1; j < who; j++, mask <<= 1)
        if (i & mask) {
          ax[cnt++] = a[j];
        }
      int flag = 0;
      for (int j = 0; j < cnt && flag == 0; j++)
        for (int k = j; k < cnt && flag == 0; k++)
          if (ax[j] + ax[k] == a[who]) {
            flag = 1;
          }
      if (flag) {
        can[mm + i] = 1;
      }
    }
  }
  vis[1] = 1;
  int now = (1 << (n - 1));
  for (int mm = 2; mm < now; mm <<= 1) {
    for (int i = (mm >> 1); i < mm; i++)
      if (can[i + mm] && vis[i]) {
        vis[mm + i] = 1;
        for (int tmp = i, lw; lw = tmp & (-tmp), tmp > 0; tmp -= lw) {
          vis[mm + i - lw] = 1;
        }
      }
  }
  int ret = 0x3f3f3f3f;
  for (int i = 1; i < now; i++)
    if (can[i + now] && vis[i]) {
      ret = min(ret, has(i));
    }
  if (ret == 0x3f3f3f3f) ret = -1;
  printf("%d\n", ret);
}
