#include <bits/stdc++.h>
using namespace std;
bool da[1 << 23];
int dt[25];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", dt + i);
  memset(da, false, sizeof(da));
  da[1] = true;
  for (int k = 1; k < n; k++) {
    for (int i = 0; i < (1 << (k - 1)); i++) {
      int j = i + (1 << (k - 1));
      if (da[j]) {
        for (int a = 0; a < k; a++) {
          if (0 != (j & (1 << a))) {
            if (dt[k] == dt[a] + dt[a]) {
              da[j + (1 << k)] = true;
              for (int c = 0; c < k; c++)
                if (0 != (j & (1 << c))) da[j + (1 << k) - (1 << c)] = true;
            }
            for (int b = a + 1; b < k; b++) {
              if (0 != (j & (1 << b)))
                if (dt[k] == dt[a] + dt[b]) {
                  da[j + (1 << k)] = true;
                  for (int c = 0; c < k; c++)
                    if (0 != (j & (1 << c))) da[j + (1 << k) - (1 << c)] = true;
                }
            }
          }
        }
      }
    }
  }
  int ans = 100;
  for (int i = (1 << (n - 1)); i < (1 << n); i++) {
    if (da[i]) {
      int tans = 0;
      for (int j = 0; j < n; j++) {
        if (0 != (i & (1 << j))) {
          tans++;
        }
      }
      ans = min(ans, tans);
    }
  }
  if (ans == 100) ans = -1;
  if (ans == 0) ans++;
  printf("%d\n", ans);
  for (;;) return 0;
}
