#include <bits/stdc++.h>
using namespace std;
int ar[25];
int store[2][1 << 23];
int count_bit(int n) {
  int i = 0;
  while (n) {
    if (n & 1) i++;
    n = n >> 1;
  }
  return i;
}
void f(int n) {
  while (n) {
    cout << (n % 2);
    n /= 2;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int i = 0, j, k, b, l;
  while (i < n) {
    scanf("%d", &ar[i]);
    i++;
  }
  vector<int> v[25];
  i = 1;
  while (i < n) {
    j = 0;
    while (j < i) {
      k = j;
      while (k < i) {
        if (ar[j] + ar[k] == ar[i]) {
          b = 1 << j;
          b |= 1 << k;
          v[i].push_back(b);
        }
        k++;
      }
      j++;
    }
    i++;
  }
  memset(store, 0, sizeof(store));
  int p, c, tm = 1;
  p = 0, c = 1;
  i = 1;
  store[0][1] = 1;
  while (i < n) {
    tm++;
    j = 0;
    while (j < (1 << i)) {
      k = v[i].size();
      while (k-- && store[p][j] == tm - 1) {
        if ((v[i][k] & j) == v[i][k]) {
          b = j | (1 << i);
          store[c][b] = tm;
          l = 0;
          while (l < i) {
            if (j & (1 << l)) {
              store[c][b - (1 << l)] = tm;
            }
            l++;
          }
        }
      }
      j++;
    }
    swap(c, p);
    i++;
  }
  i = 0;
  int mn = 30;
  while (i < (1 << n)) {
    if (store[p][i] == tm) {
      mn = min(count_bit(i), mn);
    }
    i++;
  }
  if (mn == 30) mn = -1;
  printf("%d\n", mn);
  return 0;
}
