#include <bits/stdc++.h>
using namespace std;
const int N = 4200000;
bool v[23][N];
int i, j, n, m, k, x, y, flag, ans, tot;
int d[25], a[25];
vector<int> q[25];
vector<int> g[25];
void Push(int i, int x) {
  if (v[i][x]) return;
  v[i][x] = 1;
  q[i].push_back(x);
}
void work() {
  for (i = 1; i < n; i++)
    if (a[i] % a[0]) {
      cout << -1;
      return;
    }
  for (i = 1; i < n; i++) {
    for (j = 0; j < i; j++)
      for (k = j; k < i; k++)
        if (a[j] + a[k] == a[i]) g[i].push_back(d[j] | d[k]);
    if (g[i].empty()) {
      cout << -1;
      return;
    }
  }
  if (n <= 2) {
    cout << 1;
    return;
  }
  v[0][0] = 1;
  q[0].push_back(0);
  ans = 100;
  for (i = 0; i < n - 1; i++) {
    for (auto j : q[i]) {
      x = j + d[i];
      flag = 0;
      for (auto p : g[i + 1])
        if ((x & p) == p) {
          flag = 1;
          break;
        }
      if (!flag) continue;
      if (i == n - 2) {
        tot = 0;
        for (; x; x -= x & (-x)) tot++;
        if (tot < ans) ans = tot;
      } else {
        Push(i + 1, x);
        for (y = x; y; y -= y & (-y)) Push(i + 1, x - (y & (-y)));
      }
    }
  }
  cout << ans;
}
int main() {
  d[0] = 1;
  for (i = 1; i <= 23; i++) d[i] = d[i - 1] * 2;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  work();
}
