#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int dp[(1 << 23) + 100];
vector<pair<int, int> > valid[25];
int a[25];
int n;
int go(int pos, int mask) {
  if (pos == n) {
    return __builtin_popcount(mask);
  }
  int& ret = dp[mask];
  if (~ret) return ret;
  ret = INF;
  if (pos == 0) {
    ret = min(ret, go(pos + 1, mask ^ (1 << pos)));
  }
  bool found = false;
  for (__typeof(valid[pos].begin()) it = valid[pos].begin();
       it != valid[pos].end(); ++it) {
    int x = it->first, y = it->second;
    if ((mask >> x & 1) and (mask >> y & 1)) {
      found = true;
      break;
    }
  }
  if (found) {
    ret = min(ret, go(pos + 1, mask ^ (1 << pos)));
    for (int i = 0; i < (n); ++i)
      if (mask >> i & 1) {
        ret = min(ret, go(pos + 1, mask ^ (1 << i) ^ (1 << pos)));
      }
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) scanf("%d", &a[i]);
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (n); ++j) {
      for (int k = 0; k < (j + 1); ++k)
        if (a[i] == a[j] + a[k]) valid[i].push_back(make_pair(j, k));
    }
  }
  memset(dp, -1, sizeof(dp));
  int ans = go(0, 0);
  if (ans == INF) ans = -1;
  printf("%d\n", ans);
  return 0;
}
