#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int maxn = 23;
struct com {
  int a, b;
};
inline bool operator<(com x, com y) { return x.a < y.a; }
int n, ans = INT_MAX, a[maxn], b[maxn];
com c[maxn];
bool v[1 << maxn];
inline bool check(int s, int k) {
  for (int i = 0; i < n; ++i) {
    if ((s & b[i]) == 0) continue;
    int p = lower_bound(c, c + n, (com){a[k] - a[i], -1}) - c;
    if (c[p].a == a[k] - a[i] && (s & b[c[p].b])) return true;
  }
  return false;
}
void dfs(int s, int k) {
  if (v[s]) return;
  v[s] = true;
  int ns = __builtin_popcount(s);
  if (k == n) {
    ans = min(ans, ns);
    return;
  }
  if (ns >= ans) return;
  if (!check(s, k)) return;
  dfs(s | b[k], k + 1);
  for (int i = 0; i < n; ++i) {
    if ((s & b[i]) == 0) continue;
    dfs(s ^ b[i] | b[k], k + 1);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    b[i] = 1 << i;
    c[i].a = a[i];
    c[i].b = i;
  }
  sort(c, c + n);
  dfs(b[0], 1);
  printf("%d\n", ans == INT_MAX ? -1 : ans);
  return 0;
}
