#include <bits/stdc++.h>
using namespace std;
const int MAXN = 24;
int f[1 << MAXN], a[MAXN], N;
vector<pair<int, int> > p[MAXN];
int dp(int state, int pos) {
  if (f[state] != -1) return f[state];
  if (state == 1) return 1;
  if (p[pos].size() == 0) {
    f[state] = 0x3F3F3F3F;
    return f[state];
  }
  int tot = 0, flag = 0;
  for (int i = 0; i <= pos; i++)
    if ((state >> i) & 1) tot++;
  int ret = 0x3F3F3F3F;
  for (int i = 0; i < p[pos].size(); i++) {
    int nxtstate = ((state & (~(1 << pos))) | (1 << pos - 1) |
                    (1 << p[pos][i].first) | (1 << p[pos][i].second));
    ret = min(dp(nxtstate, pos - 1), ret);
  }
  return f[state] = max(ret, tot);
}
int main() {
  scanf("%d", &N);
  memset(f, -1, sizeof(f));
  for (int i = 0; i < N; i++) scanf("%d", a + i);
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < i; j++)
      for (int k = j; k < i; k++)
        if (a[j] + a[k] == a[i]) p[i].push_back(make_pair(j, k));
  }
  int ans = dp(1 << (N - 1), N - 1);
  if (ans == 0x3F3F3F3F)
    printf("-1\n");
  else
    printf("%d\n", ans);
  return 0;
}
