#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int M = 23;
const int inf = 1e9 + 7;
const long long base = 1e18;
const double pi = acos(-1);
const double ep = 1e-9;
map<int, int> st;
int pre[1 << M];
int cur[1 << M];
int n;
int a[N];
int main() {
  cin >> n;
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
    st[a[i]] = i - 1;
  }
  for (int mask = 0; mask < 1 << M; mask++) cur[mask] = inf;
  cur[1] = 1;
  for (int i = 2; i < n + 1; i++) {
    for (int mask = 0; mask < 1 << (i - 1); mask++) {
      pre[mask] = cur[mask];
      cur[mask] = inf;
    }
    for (int mask = 0; mask < 1 << (i - 1); mask++) {
      if (pre[mask] >= inf) continue;
      bool check = false;
      for (int j = 0; j + 1 < i; j++) {
        if ((mask & (1 << j)) && st.count(a[i] - a[j + 1]) &&
            (mask & (1 << st[a[i] - a[j + 1]]))) {
          check = true;
          break;
        }
      }
      if (!check) continue;
      for (int j = 0; j + 1 < i; j++)
        if (mask & (1 << (j))) {
          int nxt = mask ^ (1 << j) ^ (1 << (i - 1));
          cur[nxt] = min(cur[nxt], pre[mask]);
        }
      int nxt = mask ^ (1 << (i - 1));
      cur[nxt] =
          min(cur[nxt], pre[mask] + (pre[mask] == __builtin_popcount(mask)));
    }
  }
  int ans = inf;
  for (int mask = 0; mask < 1 << n; mask++) ans = min(ans, cur[mask]);
  if (ans == inf) ans = -1;
  cout << ans << endl;
}
