#include <bits/stdc++.h>
using namespace std;
bool tmp[9000000][23] = {};
int n, rz = (int)1e9, sum[56][23][2] = {}, sz[23] = {};
void go(int mask, int turns, int usd) {
  int i, j, x, y;
  if (tmp[mask][turns]) return;
  tmp[mask][turns] = true;
  if (turns == n) {
    rz = min(rz, usd);
    return;
  }
  if (rz <= usd) return;
  for (i = 0; i < sz[turns]; i++) {
    x = sum[turns][i][0];
    y = sum[turns][i][1];
    if (mask & (1 << x) && mask & (1 << y)) {
      mask ^= (1 << turns);
      go(mask, turns + 1, usd + 1);
      for (j = 0; j < turns; j++)
        if (mask & (1 << j)) {
          mask ^= (1 << j);
          go(mask, turns + 1, usd);
          mask ^= (1 << j);
        }
      mask ^= (1 << turns);
    }
  }
}
int main() {
  int i, j, k, a[99];
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (k = 0; k < n; k++)
    for (i = 0; i < k; i++)
      for (j = 0; j < k; j++)
        if (a[i] + a[j] == a[k])
          sum[k][sz[k]][0] = i, sum[k][sz[k]][1] = j, sz[k]++;
  go(1, 1, 1);
  cout << (rz == (int)1e9 ? -1 : rz);
}
