#include <bits/stdc++.h>
using namespace std;
int n, a[25], dp[1 << 23];
int fun(int m, int x) {
  if (dp[m]) return dp[m];
  int c = __builtin_popcount(m), v = 0, mn = 25;
  for (int i = 0; i < x; i++) {
    for (int j = 0; j <= i; j++) {
      if (a[i] + a[j] == a[x]) {
        v = fun((m & ~(1 << x)) | (1 << (x - 1)) | (1 << i) | (1 << j), x - 1);
        mn = min(mn, max(v, c));
      }
    }
  }
  return dp[m] = mn;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  dp[1] = 1;
  int ans = fun(1 << (n - 1), n - 1);
  if (ans == 25) ans = -1;
  printf("%d\n", ans);
  return 0;
}
