#include <bits/stdc++.h>
using namespace std;
const int MXN = 23;
const long long INF = 50;
int N;
long long A[MXN];
long long dp[(1 << MXN) + 9];
vector<int> masks[MXN];
inline long long go(long long Mask, int assigned) {
  if (assigned == N) return __builtin_popcount(Mask);
  if (~dp[Mask]) return dp[Mask];
  long long ret = INF;
  bool isPossible = false;
  for (int i = 0; (i < (int)masks[assigned].size()) && (isPossible == false);
       ++i)
    if ((masks[assigned][i] & Mask) == masks[assigned][i]) isPossible = true;
  if (!isPossible) return ret;
  ret = min(ret, go(Mask | (1 << assigned), assigned + 1));
  for (int i = 0; i < N; ++i)
    if (Mask & (1 << i))
      ret = min(ret, go((Mask ^ (1 << i)) | (1 << assigned), assigned + 1));
  return dp[Mask] = ret;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> A[i];
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < N; ++j)
      for (int k = 0; k < N; ++k)
        if (A[i] == A[j] + A[k]) masks[i].push_back((1 << j) | (1 << k));
  memset(dp, -1, sizeof(dp));
  cout << ((go(1, 1) >= INF) ? -1 : go(1, 1)) << "\n";
  return 0;
}
