#include <bits/stdc++.h>
using namespace std;
const int MAXN = 23;
const int oops = 1000;
int arr[MAXN + 5];
int n;
int best[1 << MAXN | 5];
int temp[MAXN + 5];
bool valid(int mask, int ind) {
  int cnt = 0;
  for (int i = 0; i < ind; i++)
    if (mask & (1 << i)) temp[cnt++] = arr[i];
  for (int i = 0; i < cnt; i++)
    for (int j = 0; j < cnt; j++)
      if (temp[i] + temp[j] == arr[ind]) return true;
  return false;
}
int solve(int mask, int i) {
  if (i == n) return __builtin_popcount(mask);
  int& ret = best[mask];
  if (~ret) return ret;
  ret = oops;
  if (valid(mask, i)) {
    ret = min(ret, solve(mask | (1 << i), i + 1));
    for (int j = 0; j < n; j++)
      if (mask & (1 << j))
        ret = min(ret, solve(mask - (1 << j) + (1 << i), i + 1));
  }
  return ret;
}
int main() {
  int c, c2;
  scanf("%d", &n);
  for (c = 0; c < n; c++) scanf("%d", &arr[c]);
  memset(best, -1, sizeof(best));
  int ret = solve(1, 1);
  if (ret == oops) ret = -1;
  printf("%d\n", ret);
  return 0;
}
