#include <bits/stdc++.h>
using namespace std;
int where[26][26];
int n, dp[(1 << 23) + 5], d[35];
bool fdp[(1 << 23) + 5];
int rec(int mask) {
  if (fdp[mask]) return dp[mask];
  int next = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (mask & (1 << i)) {
      next = i;
      break;
    }
  }
  next++;
  fdp[mask] = 1;
  if (next == n) return dp[mask] = __builtin_popcount(mask);
  int make = d[next + 1];
  dp[mask] = 30;
  int valid = 0;
  for (int i = 0; i < n; ++i) {
    if (mask & (1 << i)) {
      int j = where[next + 1][i + 1];
      if (d[i + 1] < make and j) {
        j--;
        if (mask & (1 << j)) valid = 1;
      }
    }
  }
  if (valid) {
    dp[mask] = rec(mask | (1 << next));
    for (int i = 0; i < next; ++i) {
      if (mask & (1 << i))
        dp[mask] = min(dp[mask], rec((mask ^ (1 << i)) | (1 << next)));
    }
  }
  return dp[mask];
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> d[i];
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      int f = d[i] - d[j];
      for (int k = 1; k <= n; ++k) {
        if (d[k] == f) {
          where[i][j] = k;
        }
      }
    }
  }
  int ans = rec(1);
  if (ans == 30) ans = -1;
  cout << ans;
}
