#include <bits/stdc++.h>
using namespace std;
int can[2][(1 << 23)], is[25][25];
int bit[(1 << 23)], a[25];
int main() {
  int n;
  scanf("%d", &n);
  memset(is, -1, sizeof(is));
  memset(can, 0, sizeof(can));
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++)
    for (int j = 0; j < i; j++)
      for (int k = j; k < i; k++)
        if (a[k] + a[j] == a[i]) is[i][j] = k;
  can[0][1] = 1;
  for (int i = 1; i < n; i++) {
    int now = (i - 1) & 1, next = i & 1;
    memset(can[next], 0, sizeof(can[next]));
    for (int j = 1; j < (1 << i); j++) {
      if (!can[now][j]) continue;
      int flag = 0;
      for (int k = 0; k < i; k++) {
        if (j & (1 << k) && is[i][k] != -1 && j & (1 << is[i][k])) {
          flag = 1;
          break;
        }
      }
      if (!flag) continue;
      for (int k = 0; k < i; k++)
        if (j & (1 << k)) can[next][j ^ (1 << k) | (1 << i)] = 1;
      can[next][j | (1 << i)] = 1;
    }
  }
  int max_n = (1 << n);
  bit[0] = 0;
  for (int i = 1; i < max_n; i++) bit[i] = bit[i - (i & (-i))] + 1;
  int ans = (1 << 23), id;
  for (int i = 0; i < (1 << n); i++)
    if (can[(n - 1) & 1][i]) {
      if (ans > bit[i]) {
        ans = bit[i];
        id = i;
      }
    }
  if (ans == (1 << 23)) ans = -1;
  printf("%d\n", ans);
  return 0;
}
