#include <bits/stdc++.h>
using namespace std;
int a[30];
char dp[24][1 << 23];
int n, m, ans = (1 << 30);
map<int, int> mp;
int count(int x) {
  int ret = 0;
  for (; x; x -= x & -x) ret++;
  return ret;
}
void find(int x, int y) {
  if (dp[x][y]) return;
  dp[x][y] = 1;
  if (x == n) {
    int tmp = 0;
    ans = min(ans, count(y));
    return;
  }
  int ret, ok = 0;
  for (int i = (0); i < (n); i++) {
    int tmp;
    if (!(y & (1 << i))) continue;
    if (!mp.count(a[x] - a[i])) continue;
    tmp = mp[a[x] - a[i]];
    if (!(y & (1 << tmp))) continue;
    ok = 1;
  }
  if (!ok) return;
  find(x + 1, y | (1 << x));
  for (int k = y; k; k -= k & -k) {
    int tmp = k & -k;
    find(x + 1, (y ^ tmp) | (1 << x));
  }
}
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) scanf("%d", a + i);
  for (int i = (0); i < (n); i++) mp[a[i]] = i;
  find(1, 1);
  printf("%d\n", ans == (1 << 30) ? -1 : ans);
  return 0;
}
