#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 10;
const int INF = 1e9 + 7;
bool dp[24][1 << 23];
int a[24];
vector<pair<int, int> > f[24];
inline void solve(void) {
  int n;
  cin >> n;
  for (int i = (0); i < (n); i++) cin >> 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]) {
          f[i].push_back(pair<int, int>(j, k));
        }
      }
    }
  }
  dp[0][0] = 1;
  int ans = INF;
  for (int i = 0; i <= n - 1; i++) {
    for (int mask = 0; mask < (1 << i); mask++) {
      if (dp[i][mask] == 0) continue;
      if (i == 0 && mask == 0) {
        dp[i + 1][1] = 1;
        continue;
      }
      bool y = false;
      int f1, f2;
      for (int j = (0); j < (f[i].size()); j++) {
        f1 = f[i][j].first, f2 = f[i][j].second;
        if (((mask | (1 << f1)) == mask) && ((mask | (1 << f2)) == mask)) {
          y = true;
          break;
        }
      }
      if (y) {
        dp[i + 1][mask | (1 << i)] = 1;
        for (int j = (0); j < (n); j++) {
          if (mask & (1 << j)) dp[i + 1][(mask ^ (1 << j)) | (1 << i)] = 1;
        }
      }
    }
  }
  for (int mask = (0); mask < ((1 << n)); mask++) {
    if (dp[n][mask] == 1) {
      ans = min(ans, __builtin_popcount(mask));
    }
  }
  if (ans == INF) ans = -1;
  cout << ans;
  return;
}
void init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
int main(int argc, const char* argv[]) {
  init();
  solve();
  return 0;
}
