#include <bits/stdc++.h>
using namespace std;
int n;
int a[50];
int dp[1LL << 23];
bool rec(int mask, int t, int m) {
  if (t == n) return 1;
  if (dp[mask] != -1) return dp[mask];
  bool v = 0;
  for (int i = 0; i < n and !v; i++) {
    if (mask & (1LL << i)) {
      for (int j = 0; j < n and !v; j++) {
        if (mask & (1LL << j)) {
          if (a[i] + a[j] == a[t]) {
            v = 1;
            break;
          }
        }
      }
    }
  }
  if (!v) {
    return 0;
  }
  v = 0;
  if (__builtin_popcount(mask) < m) {
    v = rec(mask | (1LL << t), t + 1, m);
  } else {
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        v |= rec((mask ^ (1 << i)) ^ (1 << t), t + 1, m);
      }
      if (v) break;
    }
  }
  dp[mask] = v;
  return v;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int m = 1; m <= n; m++) {
    for (int mask = 0; mask < (1LL << n); mask++) {
      dp[mask] = -1;
    }
    if (rec(1, 1, m)) {
      cout << m;
      return 0;
    }
  }
  cout << -1;
}
