#include <bits/stdc++.h>
using namespace std;
int n;
int a[100];
short dp[1 << 23];
short memo(int v, int bit) {
  if (dp[bit] != 0) return dp[bit];
  short res = 50;
  for (int i = 0; i < v; i++) {
    if (bit >> i & 1) {
      for (int j = i; j < v; j++) {
        if ((bit >> j & 1) && a[i] + a[j] == a[v]) {
          if (v == n - 1) {
            res = __builtin_popcount(bit);
            return dp[bit] = res;
          }
          int nbit = bit;
          nbit += 1 << v;
          res = min(res, memo(v + 1, nbit));
          for (int k = 0; k < v; k++) {
            if (bit >> k & 1) {
              nbit -= 1 << k;
              res = min(res, memo(v + 1, nbit));
              nbit += 1 << k;
            }
          }
        }
      }
    }
  }
  return dp[bit] = res;
}
int main(void) {
  scanf("%d", &n);
  if (n == 1) {
    puts("1");
    return 0;
  }
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  short res = memo(1, 1);
  if (res >= 50)
    puts("-1");
  else
    printf("%d\n", res);
  return 0;
}
