#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, t, now, temp, x, y, op, ans;
long long a[30], fina[9000005], one[9000005];
bool f[9000005], flag;
struct node {
  long long tot, a[605], b[605];
};
node e[30];
void Get(long long &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
int main() {
  Get(n);
  for (i = 1; i <= n; i++) Get(a[i]);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      for (k = j; k <= n; k++) {
        if (a[j] + a[k] == a[i]) {
          e[i].tot++;
          x = e[i].tot;
          e[i].a[x] = j;
          e[i].b[x] = k;
        }
      }
  t = (1 << n) - 1;
  for (i = 1; i <= t; i++) {
    for (j = 1; j <= n; j++)
      if ((i & (1 << (j - 1))) > 0) {
        fina[i] = j;
        one[i]++;
      }
  }
  f[1] = true;
  for (i = 1; i <= t; i++) {
    if (!f[i]) continue;
    if (fina[i] == n) break;
    now = fina[i] + 1;
    temp = (i | (1 << (now - 1)));
    flag = false;
    for (j = 1; j <= e[now].tot; j++) {
      x = e[now].a[j];
      y = e[now].b[j];
      if ((i & (1 << (x - 1))) > 0 && (i & (1 << (y - 1))) > 0) {
        flag = true;
        break;
      }
    }
    if (!flag) continue;
    f[temp] = true;
    for (j = 1; j <= fina[i]; j++) {
      if ((i & (1 << (j - 1))) > 0) {
        op = (temp ^ (1 << (j - 1)));
        f[op] = true;
      }
    }
  }
  op = (1 << (n - 1));
  ans = 1999999999;
  for (i = op; i <= t; i++) {
    if (f[i] && one[i] < ans) ans = one[i];
  }
  if (ans == 1999999999)
    printf("-1\n");
  else
    printf("%I64d\n", ans);
  return 0;
}
