#include <bits/stdc++.h>
using namespace std;
int bit(int n) { return n ? 1 + bit(n - (n & -n)) : 0; }
int dp[1 << 23], n, a[25];
int dfs(int second, int u) {
  int& r = dp[second];
  if (r) return r;
  r = 0x3f3f3f3f;
  if (u) {
    for (int i = 0; i < u; i++)
      for (int j = 0; j < u; j++)
        if (a[i] + a[j] == a[u]) {
          r = min(
              r, dfs((second ^ (1 << u)) | (1 << (u - 1)) | (1 << i) | (1 << j),
                     u - 1));
        }
    r = max(r, bit(second));
  } else
    r = 1;
  return r;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  int ans = dfs(1 << (n - 1), n - 1);
  if (ans == 0x3f3f3f3f) ans = -1;
  printf("%d\n", ans);
  return 0;
}
