You've got a positive integer sequence a1, a2, ..., an. All numbers in the sequence are distinct. Let's fix the set of variables b1, b2, ..., bm. Initially each variable bi (1 ≤ i ≤ m) contains the value of zero. Consider the following sequence, consisting of n operations.

The first operation is assigning the value of a1 to some variable bx (1 ≤ x ≤ m). Each of the following n - 1 operations is assigning to some variable by the value that is equal to the sum of values that are stored in the variables bi and bj (1 ≤ i, j, y ≤ m). At that, the value that is assigned on the t-th operation, must equal at. For each operation numbers y, i, j are chosen anew.

Your task is to find the minimum number of variables m, such that those variables can help you perform the described sequence of operations.

Input

The first line contains integer n (1 ≤ n ≤ 23). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ak ≤ 109).

It is guaranteed that all numbers in the sequence are distinct.

Output

In a single line print a single number — the minimum number of variables m, such that those variables can help you perform the described sequence of operations.

If you cannot perform the sequence of operations at any m, print -1.

Examples

Input

5
1 2 3 6 8


Output

2


Input

3
3 6 5


Output

-1


Input

6
2 4 8 6 10 18


Output

3

Note

In the first sample, you can use two variables b1 and b2 to perform the following sequence of operations.

  1. b1 := 1; 
  2. b2 := b1 + b1; 
  3. b1 := b1 + b2; 
  4. b1 := b1 + b1; 
  5. b1 := b1 + b2. 
#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1e18 + 5;
const int MOD = (int)1e9 + 7;
const int LOG = 18;
const int INF = 1e3;
const int N = 25;
const int M = (1 << 23) + 5;
const int SQ = 350;
unordered_map<int, short int> ind;
int a[N], pw[N];
short int dp[M], ans, n;
short int dfs(int cur, int mask, int var) {
  if (cur == n + 1) return var;
  if (dp[mask] != -1) return dp[mask];
  bool can = false;
  for (int i = 1; i < cur; i++)
    if ((mask & pw[i - 1]) && (mask & (pw[ind[a[cur] - a[i]] - 1]))) {
      can = true;
      break;
    }
  if (can == false) return dp[mask] = INF;
  int tutmask = mask;
  mask += pw[cur - 1];
  dp[tutmask] = dfs(cur + 1, mask, var + 1);
  for (int i = 1; i < cur; i++) {
    if ((mask & pw[i - 1]))
      dp[tutmask] = min(dp[tutmask], dfs(cur + 1, mask - pw[i - 1], var));
  }
  return dp[tutmask];
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%d", &n);
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = pw[i - 1] * 2;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ind[a[i]] = i;
  }
  ans = dfs(2, 1, 1);
  if (ans == INF) ans = -1;
  printf("%d\n", ans);
  return 0;
}
