#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100];
vector<pair<int, int> > can[100];
int ones(int mask) {
  int ans = 0;
  while (mask) {
    ans += mask % 2;
    mask /= 2;
  }
  return ans;
}
int memo[1 << 23];
bool vis[1 << 23];
int dp(int u, int mask) {
  if (u == 0) return 1;
  int &ret = memo[mask];
  if (vis[mask]) return ret;
  vis[mask] = 1;
  ret = 100;
  mask &= (~(1 << (u + 1)));
  mask |= (1 << u);
  for (int i = 0; i < can[u].size(); i++) {
    int x = can[u][i].first, y = can[u][i].second;
    ret = min(ret, dp(u - 1, (mask | (1 << x)) | (1 << y)));
  }
  ret = max(ret, ones(mask));
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      for (int k = 0; k <= j; k++) {
        if (a[i] == a[j] + a[k]) can[i].push_back(make_pair(j, k));
      }
    }
    if (i && can[i].empty()) return cout << -1 << endl, 0;
  }
  memset(memo, -1, sizeof memo);
  cout << dp(n - 1, 0) << endl;
  return 0;
}
