#include <bits/stdc++.h>
using namespace std;
int n;
int arr[25];
map<vector<int>, bool> dp;
bool ok(vector<int> V, int obj) {
  unordered_set<int> aux;
  for (int i = 0; i < V.size(); i++) {
    aux.insert(V[i]);
  }
  for (unordered_set<int>::iterator it = aux.begin(); it != aux.end(); ++it) {
    if (aux.find(obj - *it) != aux.end()) return true;
  }
  return false;
}
bool solve(vector<int> V, int pasos) {
  sort(V.begin(), V.end());
  if (pasos == n) return true;
  if (dp.find(V) != dp.end()) return dp[V];
  int obj = arr[pasos];
  if (ok(V, obj)) {
    for (int k = 0; k < V.size(); k++) {
      vector<int> aux = V;
      aux[k] = obj;
      if (solve(aux, pasos + 1)) return dp[V] = true;
    }
  }
  return dp[V] = false;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int ans = 50;
  for (int i = 1; i <= n; i++) {
    vector<int> arr2(i);
    for (int j = 0; j < i; j++) {
      arr2[j] = 0;
    }
    arr2[0] = arr[0];
    if (solve(arr2, 1)) {
      ans = i;
      break;
    }
  }
  if (ans == 50)
    cout << -1 << '\n';
  else
    cout << ans << '\n';
  return 0;
}
