#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int n, a[25], dp[(1 << 24)];
vector<pair<int, int> > v[25];
int f(int mask, int x) {
  if (x == n) return __builtin_popcount(mask);
  if (dp[mask] != -1) return dp[mask];
  int mn = 1e9;
  for (int z = 0; z < v[x].size(); z++) {
    int i = v[x][z].first, j = v[x][z].second;
    if ((mask & (1 << i)) && (mask & (1 << j))) {
      int maskk = (mask | (1 << x));
      mn = min(mn, f(maskk, x + 1));
      for (int z = 0; z < x; z++) {
        maskk = (maskk ^ (1 << z));
        mn = min(mn, f(maskk, x + 1));
        maskk = (maskk ^ (1 << z));
      }
    }
  }
  return dp[mask] = mn;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  memset(dp, -1, sizeof dp);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    for (int j = 0; j < i; j++) {
      for (int z = j; z < i; z++) {
        if (a[j] + a[z] == a[i]) v[i].push_back({j, z});
      }
    }
  }
  int x = f(1, 1);
  if (x == 1e9)
    printf("-1");
  else
    printf("%d", x);
}
