#include <bits/stdc++.h>
int n, la = 2140000000;
int a[25];
int b[25][20005][3];
int b1[25];
int d[(1 << 23) + 10];
int main() {
  int i, j, k, l, o;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i < n; i++)
    for (j = i; j < n; j++)
      for (k = j + 1; k <= n; k++)
        if (a[k] == a[i] + a[j])
          b[k][++b1[k]][1] = i - 1, b[k][b1[k]][2] = j - 1;
  for (i = 0; i <= (1 << n); i++) d[i] = 2140000000;
  d[1] = 1;
  int i1;
  for (i = 2; i <= n; i++) {
    i1 = 1 << (i - 1);
    for (j = (1 << (i - 2)); j < (1 << (i - 1)); j++) {
      for (k = b1[i]; k >= 1; k--)
        if (((j & (1 << b[i][k][1])) != 0) && ((j & (1 << b[i][k][2])) != 0)) {
          if (d[j + i1] > d[j] + 1) d[j + i1] = d[j] + 1;
          for (l = 0; l <= (i - 2); l++)
            if ((j & (1 << l)) != 0)
              if (d[j + i1 - (j & (1 << l))] > d[j])
                d[j + i1 - (j & (1 << l))] = d[j];
          break;
        }
    }
  }
  for (i = 1 << (n - 1); i < (1 << n); i++)
    if (d[i] < la) la = d[i];
  if (la == 2140000000) la = -1;
  printf("%d", la);
  return 0;
}
