#include <bits/stdc++.h>
using namespace std;
int a[30];
vector<int> vld[30];
int match[30][30];
bool ok[(1 << 23) + 5];
int main() {
  memset(match, -1, sizeof match);
  int n;
  scanf("%d", &n);
  for (int i = 0; i <= n - 1; i++) scanf("%d", &a[i]);
  for (int i = 0; i <= n - 1; i++)
    for (int j = 0; j <= i - 1; j++)
      for (int k = 0; k <= j; k++)
        if (a[i] == a[j] + a[k]) {
          vld[i].push_back((1 << j) | (1 << k));
          match[i][j] = k;
          match[i][k] = j;
        }
  int N = 1 << n;
  ok[1] = 1;
  for (int s = 2; s <= N - 1; s++) {
    int i = 31 - __builtin_clz(s);
    int f = 0;
    for (auto x : vld[i])
      if ((s & x) == x) f = 1;
    int ss = s ^ (1 << i);
    if (f && ss & (1 << i - 1)) ok[s] |= ok[ss];
    for (int j = 0; j <= i - 1; j++)
      if (((1 << j) & s) == 0) {
        if (f || (match[i][j] != -1 &&
                  ((ss >> match[i][j]) & 1 || match[i][j] == j))) {
          if ((ss ^ (1 << j)) & (1 << i - 1)) ok[s] |= ok[ss ^ (1 << j)];
        }
      }
  }
  int ans = 0x3f3f3f3f;
  for (int s = N - 1; s >= 0; s--) {
    if (s & (1 << n - 1)) {
      if (ok[s]) ans = min(ans, __builtin_popcount(s));
    } else
      break;
  }
  if (ans == 0x3f3f3f3f)
    puts("-1");
  else
    printf("%d\n", ans);
  return 0;
}
