#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void checkMin(T& a, T b) {
  if (a > b) a = b;
}
template <typename T>
inline void checkMax(T& a, T b) {
  if (a < b) a = b;
}
const int MAXN = 1 << 22;
const int INF = ~0U >> 2;
int n, a[30];
bool ok() {
  for (int i = 0; i < int(n - 1); ++i) {
    int j = i + 1;
    bool can = false;
    for (int k = 0; k < int(j); ++k) {
      for (int p = 0; p < int(j); ++p) {
        if (a[k] + a[p] == a[j]) {
          can = true;
        }
      }
    }
    if (!can) {
      return false;
    }
  }
  return true;
}
bool vis[2][MAXN];
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < int(n); ++i) {
    cin >> a[i];
  }
  if (!ok()) {
    cout << -1 << endl;
  } else {
    int cur = 0, pre = 1;
    vis[cur][0] = true;
    for (int i = 1; i < n; ++i) {
      swap(cur, pre);
      int to = 1 << i;
      fill(vis[cur], vis[cur] + to, false);
      int pre_s = 1 << (i - 1);
      for (int s = 0; s < pre_s; ++s) {
        if (vis[pre][s]) {
          int ss = s | (1 << (i - 1));
          bool can = false;
          for (int o1 = 0; o1 < i && !can; ++o1)
            if (ss & (1 << o1)) {
              for (int o2 = o1; o2 < i && !can; ++o2)
                if (ss & (1 << o2)) {
                  if (a[o1] + a[o2] == a[i]) {
                    can = true;
                  }
                }
            }
          if (can) {
            vis[cur][ss] = true;
            for (int o1 = 0; o1 < i; ++o1)
              if (ss & (1 << o1)) {
                vis[cur][ss ^ (1 << o1)] = true;
              }
          }
        }
      }
    }
    int ans = n;
    for (int s = 0; s < (1 << (n - 1)); ++s) {
      if (vis[cur][s]) {
        int temp = 0;
        for (int i = 0; (1 << i) <= s; ++i) {
          temp += (s >> i) & 1;
        }
        checkMin(ans, temp + 1);
      }
    }
    cout << ans << endl;
  }
  return 0;
}
