#include <bits/stdc++.h>
using namespace std;
bool f[9000000];
int a[30];
bool check(int sta, int i) {
  if (sta & (1 << (i - 1)))
    ;
  else
    return false;
  for (int j = 0; j < i; j++)
    if (sta & (1 << j))
      for (int k = j; k < i; k++)
        if (sta & (1 << k))
          if (a[j] + a[k] == a[i]) return true;
  return false;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  memset(f, false, sizeof(f));
  f[1] = true;
  for (int i = 1; i < n; i++) {
    int l = 1 << i, r = 1 << (i + 1);
    for (int j = l; j < r; j++)
      if (f[j - l] && check(j, i)) {
        f[j] = true;
        for (int k = 0; k < i; k++) f[j & (~(1 << k))] = true;
      }
  }
  int ans = 30;
  for (int i = (1 << (n - 1)); i < (1 << n); i++)
    if (f[i]) {
      int total = 0;
      for (int j = 0; j < n; j++)
        if (i & (1 << j)) total++;
      ans = ((ans) < (total) ? (ans) : (total));
    }
  printf("%d\n", ans == 30 ? -1 : ans);
  return 0;
}
