#include <bits/stdc++.h>
using namespace std;
bool checkbit(int mask, int bit) { return mask & (1 << bit); }
int setbit(int mask, int bit) { return mask | (1 << bit); }
int togglebit(int mask, int bit) { return mask ^ (1 << bit); }
int n;
int gg[30][30];
vector<int> v;
int dp[(1 << 23) + 10];
int f(int mask, int pos) {
  if (checkbit(mask, n - 1)) {
    return __builtin_popcount(mask);
  }
  if (dp[mask] != -1) return dp[mask];
  bool ok = 0;
  int nextMask = setbit(mask, pos);
  int ans = INT_MAX / 2;
  for (int j = pos - 1; j >= 0; j--) {
    if (checkbit(mask, j) && gg[j][pos] != -1 && checkbit(mask, gg[j][pos])) {
      ok = 1;
      break;
    }
  }
  if (ok) ans = min(ans, f(nextMask, pos + 1));
  for (int j = pos - 1; j >= 0 && ok; j--) {
    if (checkbit(mask, j)) ans = min(ans, f(togglebit(nextMask, j), pos + 1));
  }
  return dp[mask] = ans;
}
int main() {
  memset(gg, -1, sizeof(gg));
  int inp;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &inp);
    v.push_back(inp);
  }
  for (int i = 0; i < n; i++)
    for (int j = i; j < n; j++)
      for (int k = j + 1; k < n; k++)
        if (v[i] + v[j] == v[k]) {
          gg[j][k] = i;
        }
  memset(dp, -1, sizeof(dp));
  int ans = f(1, 1);
  if (ans == INT_MAX / 2) ans = -1;
  cout << ans << '\n';
  return 0;
}
