#include <bits/stdc++.h>
using namespace std;
template <class T>
inline int size(const T& c) {
  return c.size();
}
using namespace std;
const int maxn = 30;
int a[maxn];
int n;
int vt[maxn][maxn];
bool F[(1 << 23) - 1];
int cnt(int bit) {
  int res = 0;
  for (int i = (0), _b = (n - 1); i <= _b; i++)
    if ((bit >> i) & 1 == 1) res++;
  return res;
}
int main() {
  cin >> n;
  for (int i = (0), _b = (n - 1); i <= _b; i++) cin >> a[i];
  for (int i = (0), _b = (n - 1); i <= _b; i++)
    for (int j = (0), _b = (n - 1); j <= _b; j++) vt[i][j] = -1;
  for (int i = (0), _b = (n - 1); i <= _b; i++)
    for (int j = (0), _b = (n - 1); j <= _b; j++)
      for (int k = (0), _b = (n - 1); k <= _b; k++)
        if (a[i] + a[j] == a[k]) vt[k][i] = j;
  memset(F, false, sizeof(F));
  F[1] = true;
  for (int i = (1), _b = ((1 << (n - 1)) - 1); i <= _b; i++) {
    if (F[i] == false) continue;
    int bd = log2(i);
    for (int k = (0), _b = (bd); k <= _b; k++)
      if (vt[bd + 1][k] != -1)
        if ((i >> k) & 1 == 1)
          if ((i >> vt[bd + 1][k]) & 1 == 1) {
            F[i | (1 << (bd + 1))] = true;
            for (int j = (0), _b = (bd); j <= _b; j++) {
              if ((i >> j) & 1 == 1) F[(i ^ (1 << j)) | (1 << (bd + 1))] = true;
            }
            break;
          }
  }
  int res = n + 1;
  for (int i = (0), _b = ((1 << n) - 1); i <= _b; i++) {
    if ((int)log2(i) == n - 1 && F[i]) res = min(res, cnt(i));
  }
  if (res == n + 1)
    cout << -1;
  else
    cout << res;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
