#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846264338327950288419716939937511;
const double eps = 1e-9;
char ch_ch_ch[1 << 20];
string gs() {
  scanf("%s", ch_ch_ch);
  return string(ch_ch_ch);
}
string gl() {
  gets(ch_ch_ch);
  return string(ch_ch_ch);
}
inline int gi() {
  int x;
  scanf("%d", &x);
  return x;
}
const int inf = 1000000000;
char dp[1 << 23];
int a[25];
int n;
int getCans[1 << 22];
vector<int> goodPairs[23];
map<int, int> values;
void genGets(int pos, int mask, int getMask) {
  if (pos == n - 1) {
    getCans[mask] = getMask;
    return;
  }
  genGets(pos + 1, mask, getMask);
  mask |= 1 << pos;
  for (int i = 0; i < (n); ++i)
    if ((mask & (1 << i)) && values.count(a[i] + a[pos]))
      getMask |= (1 << values[a[i] + a[pos]]);
  genGets(pos + 1, mask, getMask);
}
inline char bitcnt(int mask) {
  char cnt = 0;
  while (mask) {
    cnt += mask & 1;
    mask >>= 1;
  }
  return cnt;
}
inline bool canGet(int mask, int pos) {
  for (int i = 0; i < (goodPairs[pos].size()); ++i)
    if ((mask & goodPairs[pos][i]) == goodPairs[pos][i]) return true;
  return false;
}
char R(int mask) {
  char& r = dp[mask];
  if (r != -1) return r;
  int last = 0;
  for (int i = 0; i < (n); ++i)
    if (mask & (1 << i)) last = i;
  if (last == n - 1) return r = bitcnt(mask);
  last++;
  if (!canGet(mask, last)) return r = 120;
  r = R(mask | (1 << last));
  for (int i = 0; i < (n); ++i)
    if (mask & (1 << i)) r = min(r, R((mask ^ (1 << i)) | (1 << last)));
  return r;
}
void solution() {
  n = gi();
  for (int i = 0; i < (n); ++i) a[i] = gi();
  for (int i = 0; i < (n); ++i) values[a[i]] = i;
  for (int k = 0; k < (n); ++k)
    for (int i = 0; i < (k); ++i)
      for (long long j = (i); j < (k); ++j)
        if (a[i] + a[j] == a[k]) goodPairs[k].push_back((1 << i) | (1 << j));
  memset(dp, -1, sizeof(dp));
  char res = R(1);
  if (res == 120) res = -1;
  cout << int(res) << endl;
}
int main(int argc, char** argv) {
  solution();
  return 0;
}
