#include <bits/stdc++.h>
using namespace std;
int n, a[25], d[25][25], f[1 << 25], ans = INT_MAX;
int popcnt(int x) {
  int cnt = 0;
  while (x > 0) cnt += (x & 1), x >>= 1;
  return cnt;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    for (int j = 0; j < i; ++j) d[i][j] = -1;
    for (int j = 0; j < i; ++j)
      for (int k = j; k < i; ++k)
        if (a[j] + a[k] == a[i]) d[i][j] = k, d[i][k] = j;
  }
  f[1] = true;
  for (int i = 1; i < n; ++i)
    for (int j = 1 << (i - 1); j < (1 << i); ++j)
      if (f[j] == true)
        for (int k = 0; k < i; ++k)
          if (j & (1 << k) && d[i][k] >= 0 && (j & (1 << d[i][k]))) {
            for (int l = 0; l <= i; ++l) f[(j & (~(1 << l))) | (1 << i)] = true;
            break;
          }
  for (int i = 1 << (n - 1); i < (1 << n); ++i)
    if (f[i] == true) ans = min(ans, popcnt(i));
  if (ans == INT_MAX)
    cout << -1;
  else
    cout << ans;
  return 0;
}
