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