#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
const int inf = 0x3f3f3f3f;
bool dp[24][(1 << 23) + 10];
vector<int> x[24], y[24];
int main() {
  int n, a[25];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++)
      for (int k = j; k < i; k++)
        if (a[k] + a[j] == a[i]) x[i].push_back(j), y[i].push_back(k);
  dp[0][1] = 1;
  for (int i = 1; i < n; i++)
    for (int j = 0; j < (1 << i); j++) {
      if (!dp[i - 1][j]) continue;
      for (int k = 0; k < (int((x[i]).size())); k++) {
        int u = x[i][k];
        int v = y[i][k];
        if ((j & (1 << u)) && (j & (1 << v))) {
          int s = j | (1 << i);
          dp[i][s] = 1;
          for (int z = 0; z < i; z++)
            if (j & (1 << z)) dp[i][(j ^ (1 << z)) | (1 << i)] = 1;
        }
      }
    }
  int ret = n + 1;
  for (int i = 0; i < (1 << n); i++) {
    if (!dp[n - 1][i]) continue;
    int tmp = 0;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) tmp++;
    ret = min(ret, tmp);
  }
  if (ret == n + 1)
    puts("-1");
  else
    printf("%d\n", ret);
  return 0;
}
