#include <bits/stdc++.h>
using namespace std;
int n, a[25], c[25], b[25], p[1 << 24], q[2][1 << 23], s[1 << 24], flag;
bool cmp(int x, int y) { return a[x] < a[y]; }
bool pd(int t) {
  int l = -1, r = n, mb = a[p[t] + 1];
  while (l < r) {
    l++;
    if (!(t & b[c[l]])) continue;
    while (l < r && (a[c[l]] + a[c[r]] > mb || (!(t & b[c[r]])))) r--;
    if (l <= r && a[c[l]] + a[c[r]] == mb) return 1;
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  if (n == 1) {
    puts("1");
    return 0;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), c[i] = i;
  sort(c + 1, c + n + 1, cmp);
  b[0] = 1;
  for (int i = 1; i <= n + 1; i++) b[i] = b[i - 1] * 2;
  for (int i = 1; i <= n; i++)
    for (int j = b[i]; j < b[i + 1]; j++) p[j] = i;
  int l = 0, r = 1, r1 = 1;
  int x = 1, y = 0, Ans = 1, t, t1;
  q[x][1] = 2;
  s[2] = 1;
  q[y][1] = 3;
  s[3] = 2;
  while (Ans <= n + 1) {
    while (l < r) {
      l++;
      t = q[x][l];
      if (s[t] != Ans) continue;
      if (pd(t)) {
        if (p[t] + 1 == n) {
          flag = t1;
          break;
        }
        for (int i = 0; i <= p[t]; i++)
          if (b[i] & t) {
            t1 = t ^ b[i] ^ b[p[t] + 1];
            if (!s[t1]) {
              s[t1] = Ans;
              q[x][++r] = t1;
            }
          }
        t1 = t ^ b[p[t] + 1];
        if (!s[t1]) {
          s[t1] = Ans + 1;
          q[y][++r1] = t1;
        }
      }
      if (flag) break;
    }
    if (flag) break;
    Ans++;
    swap(x, y);
    l = 0;
    r = r1;
    r1 = 0;
  }
  printf("%d\n", Ans > n + 1 ? -1 : Ans);
}
