#include <bits/stdc++.h>
inline int getInt() {
  int s;
  scanf("%d", &s);
  return s;
}
using namespace std;
int n;
int a[30];
int memo[1 << 23];
const int inf = 100;
int get(int x) {
  int z = 0;
  while (x) {
    z += x & 1;
    x >>= 1;
  }
  return z;
}
int solve(int flag) {
  if (memo[flag] != -1) return memo[flag];
  if (flag == 1) return 1;
  int ret = inf;
  int b = get(flag);
  for (int i = n - 1; i >= 0; i--) {
    if (flag & (1 << i)) {
      int next = (flag ^ (1 << i)) | (1 << (i - 1));
      for (int j = 0; j < (int)(i); j++)
        for (int k = 0; k < (int)(j + 1); k++) {
          if (a[j] + a[k] == a[i]) {
            int tmp = solve(next | (1 << j) | (1 << k));
            if (tmp != inf) {
              ret = min(ret, max(b, tmp));
            }
          }
        }
      break;
    }
  }
  return memo[flag] = ret;
}
int main() {
  n = getInt();
  for (int i = 0; i < (int)(n); i++) a[i] = getInt();
  memset(memo, -1, sizeof(memo));
  int ans = solve(1 << (n - 1));
  if (ans == inf) ans = -1;
  printf("%d\n", ans);
  return 0;
}
