#include <bits/stdc++.h>
using namespace std;
int dp[(1 << 24)], dp2[(1 << 24)];
int d[25][25];
bool updated[(1 << 24)];
int getmsb(int x) {
  x |= (x >> 1);
  x |= (x >> 2);
  x |= (x >> 4);
  x |= (x >> 8);
  x |= (x >> 16);
  x++;
  x >>= 1;
  return (x) ? (log2(x)) : -1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]] = i;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      d[i][j] = (m.find(a[i] - a[j]) != m.end()) ? m[a[i] - a[j]] : -1;
    }
  }
  int ans = (int)1e9;
  dp[1] = 1;
  if (n == 1) ans = 1;
  for (int mask = 2; mask < (1 << n); mask++) {
    dp[mask] = (int)1e9;
    dp2[mask] = (int)1e9;
  }
  for (int mask = 1; mask < (1 << (n - 1)); mask++) {
    int msb = getmsb(mask);
    bool can = false;
    if (dp[mask] >= ans) continue;
    for (int j = 0; j < n; j++) {
      if ((mask & (1 << j)) && (d[msb + 1][j] != -1) &&
          (mask & (1 << d[msb + 1][j]))) {
        can = true;
        break;
      }
    }
    vector<int> updated2;
    if (can) {
      for (int j = 0; j < n; j++) {
        if (mask & (1 << j)) {
          dp2[mask ^ (1 << (msb + 1)) ^ (1 << j)] =
              min(dp2[mask ^ (1 << (msb + 1)) ^ (1 << j)], dp[mask]);
          if (!updated[(mask ^ (1 << (msb + 1)) ^ (1 << j))]) {
            updated[(mask ^ (1 << (msb + 1)) ^ (1 << j))] = true;
            updated2.push_back((mask ^ (1 << (msb + 1)) ^ (1 << j)));
          }
        }
      }
      dp2[mask ^ (1 << (msb + 1))] =
          min(dp2[mask ^ (1 << (msb + 1))], dp[mask] + 1);
      if (!updated[(mask ^ (1 << (msb + 1)))]) {
        updated[(mask ^ (1 << (msb + 1)))] = true;
        updated2.push_back((mask ^ (1 << (msb + 1))));
      }
      for (auto k : updated2) {
        dp[k] = dp2[k];
        if (k & (1 << (n - 1))) ans = min(ans, dp[k]);
        dp2[k] = (int)1e9;
        updated[k] = false;
      }
    }
  }
  if (ans == (int)1e9) ans = -1;
  cout << ans << "\n";
}
