#include <bits/stdc++.h>
using namespace std;
int ar[50];
int dp[(1 << 23) + 5];
int g[50][50];
int n;
int solve(int mask, int pos) {
  if (mask & (1 << (n - 1))) {
    return __builtin_popcount(mask);
  }
  if (dp[mask] != -1) return dp[mask];
  int ans = INT_MAX;
  int nextMask = mask | (1 << pos);
  bool ok = false;
  for (int i = pos - 1; i >= 0; i--) {
    if ((mask & (1 << i)) && g[i][pos] != -1 && (mask & (1 << g[i][pos]))) {
      ok = true;
      break;
    }
  }
  if (ok) ans = min(ans, solve(nextMask, pos + 1));
  for (int i = pos - 1; i >= 0 && ok; i--) {
    if ((mask & (1 << i))) ans = min(ans, solve(nextMask ^ (1 << i), pos + 1));
  }
  return dp[mask] = ans;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ar[i];
  memset(dp, -1, sizeof(dp));
  memset(g, -1, sizeof(g));
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if (ar[i] + ar[j] == ar[k]) g[j][k] = i;
      }
    }
  }
  int res = solve(1, 1);
  if (res == INT_MAX)
    cout << "-1" << endl;
  else
    cout << res << endl;
}
