#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int dp[1 << 23];
long long a[30];
int i, j, k, n;
int b[30][30];
int main() {
  scanf("%d", &n);
  memset(b, -1, sizeof(b));
  for (i = 0; i < n; i++) scanf("%I64d", &a[i]);
  for (i = 0; i < n; i++)
    for (j = i; j < n; j++)
      for (k = j + 1; k < n; k++)
        if (a[i] + a[j] == a[k]) b[k][i] = j;
  for (i = 0; i < (1 << n); i++) dp[i] = inf;
  dp[1] = 1;
  for (i = 0; i < (1 << (n - 1)); i++) {
    if (dp[i] == inf) continue;
    int temp = i, p = 0;
    while (temp) {
      temp >>= 1;
      p++;
    }
    int flag = 0;
    for (j = 0; j < p; j++) {
      if (((i >> j) & 1) && b[p][j] != -1 && ((i >> b[p][j]) & 1)) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      int num = 0;
      for (j = 0; j < p; j++)
        if ((i >> j) & 1) num++;
      dp[i | (1 << p)] = min(dp[i | (1 << p)], max(dp[i], num + 1));
      for (j = 0; j < p; j++) {
        if ((i >> j) & 1) {
          int temp = i - (1 << j) + (1 << p);
          dp[temp] = min(dp[temp], max(dp[i], num));
        }
      }
    }
  }
  int ans = inf;
  for (i = (1 << (n - 1)); i < (1 << n); i++) ans = min(ans, dp[i]);
  if (ans >= inf)
    printf("-1\n");
  else
    printf("%d\n", ans);
  return 0;
}
