#include <bits/stdc++.h>
using namespace std;
bool dp[(1 << 23)];
bool dpn[(1 << 23)];
int nos[23];
vector<vector<pair<int, int> > > match;
int bitcnt(int N) {
  int total = 0;
  for (int i = 0; i < 25; i++)
    if (N & (1 << i)) total += 1;
  return total;
}
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> nos[i];
  match.resize(N);
  for (int n = 0; n < N; n++)
    for (int i = 0; i < n; i++)
      for (int j = i; j < n; j++)
        if (nos[i] + nos[j] == nos[n]) match[n].push_back(make_pair(i, j));
  dp[0] = false;
  dp[1] = true;
  for (int n = 1; n < N; n++) {
    for (int i = 0; i < (1 << n); i++) dpn[i | (1 << n)] = dpn[i] = false;
    for (int i = 0; i < match[n].size(); i++) {
      int x = match[n][i].first, y = match[n][i].second;
      int mask = ((1 << x) | (1 << y));
      for (int j = 0; j < (1 << n); j++)
        if ((j & mask) == mask && dp[j]) {
          dpn[(1 << n) | j] = true;
          for (int k = 0; k < n; k++) {
            int neg = ~(1 << k);
            dpn[neg & (j | (1 << n))] = true;
          }
        }
    }
    for (int i = 0; i < (1 << (n + 1)); i++) dp[i] = dpn[i];
  }
  int minVal = 40;
  for (int i = 0; i < (1 << N); i++)
    if (dp[i]) minVal = min(minVal, bitcnt(i));
  cout << (minVal != 40 ? minVal : -1) << endl;
  return 0;
}
