#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
const int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int leap[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
char dp[24][(1 << 23) + 10];
int a[33], n;
int main() {
  int i, j, k, l;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < 24; i++) {
    for (j = 0; j < (1 << 23) + 10; j++) {
      dp[i][j] = 100;
    }
  }
  dp[0][1 << 0] = 1;
  int bt[33], f;
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < (1 << (i + 1)); j++)
      if (dp[i][j] < 100) {
        f = 0;
        for (k = 0; k < n; k++)
          if (j & (1 << k)) bt[f++] = k;
        bool bi = true;
        for (k = 0; bi && k < f; k++)
          for (l = k; bi && l < f; l++)
            if (a[bt[k]] + a[bt[l]] == a[i + 1]) bi = false;
        if (!bi) {
          dp[i + 1][j | (1 << (i + 1))] =
              min(dp[i + 1][j | (1 << (i + 1))], (char)(dp[i][j] + 1));
          for (int l = 0; l < f; ++l)
            dp[i + 1][(j | (1 << (i + 1))) ^ (1 << bt[l])] =
                min(dp[i + 1][(j | (1 << (i + 1))) ^ (1 << bt[l])], dp[i][j]);
        }
      }
  }
  int ans = 100;
  for (i = 0; i < (1 << 23) + 10; i++) {
    ans = min(ans, (int)dp[n - 1][i]);
  }
  if (ans > n) ans = -1;
  printf("%d\n", ans);
  return 0;
}
