#include <bits/stdc++.h>
using namespace std;
const int N = 23;
const int INF = 1e9 + 7;
int n, a[N], cnt[1 << N];
bool dp[1 << N];
vector<pair<int, int> > e[N];
int bfs() {
  int ret = INF;
  memset(dp, false, sizeof(dp));
  queue<pair<int, int> > que;
  dp[1 << 0] = true, que.push(make_pair(1, 1 << 0));
  while (!que.empty()) {
    int t = que.front().first;
    int msk = que.front().second;
    que.pop();
    if (t == n) {
      ret = min(ret, cnt[msk]);
      continue;
    }
    for (int i = (0); i < (((int)(e[t]).size())); ++i) {
      int x = e[t][i].first, y = e[t][i].second;
      if ((msk >> x & 1) && (msk >> y & 1)) {
        int nmsk = msk ^ (1 << t);
        if (!dp[nmsk]) dp[nmsk] = true, que.push(make_pair(t + 1, nmsk));
        for (int j = (0); j < (t); ++j)
          if (msk >> j & 1) {
            nmsk = msk ^ (1 << t) ^ (1 << j);
            if (!dp[nmsk]) dp[nmsk] = true, que.push(make_pair(t + 1, nmsk));
          }
      }
    }
  }
  return ret >= INF ? -1 : ret;
}
void init() {
  for (int t = (0); t < (n); ++t)
    for (int i = (0); i < (n); ++i)
      for (int j = (i); j < (n); ++j)
        if (a[i] + a[j] == a[t]) e[t].push_back(make_pair(i, j));
  for (int i = (1); i < (1 << n); ++i) cnt[i] = 1 + cnt[i ^ (i & -i)];
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  init();
  printf("%d", bfs());
  return 0;
}
