#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;
int n, a[23], dp[1 << 23];
int main() {
  cin >> n;
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  for (int i = 0; i < (int)1 << n; i++) dp[i] = inf;
  dp[1] = 1;
  for (int i = 1; i < n; i++)
    for (int j = 0; j < (int)1 << i; j++)
      if ((j & 1 << i - 1) && dp[j] < inf) {
        bool ok = 0;
        for (int k = 0; k < (int)i; k++)
          if (j & 1 << k)
            for (int l = 0; l < (int)k + 1; l++)
              if (j & 1 << l)
                if (a[k] + a[l] == a[i]) {
                  ok = 1;
                  goto OUT;
                }
      OUT:
        if (!ok) continue;
        dp[j ^ 1 << i] = min(dp[j ^ 1 << i], dp[j] + 1);
        for (int m = 0; m < (int)i; m++)
          if (j & 1 << m)
            dp[j ^ 1 << i ^ 1 << m] = min(dp[j ^ 1 << i ^ 1 << m], dp[j]);
      }
  int ans = inf;
  for (int i = 0; i < (int)1 << n; i++)
    if (i & 1 << (n - 1)) ans = min(ans, dp[i]);
  cout << (ans == inf ? -1 : ans) << endl;
  return 0;
}
