#include <bits/stdc++.h>
using namespace std;
int N, A[24];
bool impossible;
bool can[1 << 23];
int where[24][24];
vector<int> V[24];
int result = 0x3f3f3f3f;
int main() {
  cin >> N;
  for (int i = 1; i <= N; ++i) cin >> A[i];
  for (int i = 2; i <= N; ++i) {
    bool any = false;
    for (int j = 1; j < i; ++j)
      for (int k = j; k < i; ++k)
        if (A[j] + A[k] == A[i]) {
          V[i].push_back(j - 1);
          V[i].push_back(k - 1);
          where[i][j] = k;
          where[i][k] = j;
          any = true;
        }
    if (!any) impossible = true;
  }
  if (impossible) {
    cout << -1 << '\n';
    return 0;
  }
  can[1] = true;
  for (int i = 2; i < (1 << N); ++i) {
    int last = 0, now = -1;
    for (int j = 0; j < N; ++j)
      if (i & (1 << j)) last = j;
    for (int j = 0; j < last; ++j)
      if (!(i & (1 << j))) now = j;
    if (now == -1)
      now = 0;
    else
      now = (1 << now);
    for (size_t k = 0; k < V[last + 1].size(); ++k) {
      int j = V[last + 1][k];
      if (A[j + 1] + A[j + 1] == A[last + 1]) {
        if (i & (1 << j))
          can[i] |= can[i ^ (1 << last) ^ now];
        else {
          if (last == 0 || ((i ^ (1 << last) ^ (1 << j)) & (1 << (last - 1))))
            can[i] |= can[i ^ (1 << last) ^ (1 << j)];
        }
      } else if (j != last && (i & (1 << j)) && where[last + 1][j + 1] != 0) {
        if (i & (1 << (where[last + 1][j + 1] - 1)))
          can[i] |= can[i ^ (1 << last) ^ now];
        else {
          if (last == 0 ||
              ((i ^ (1 << last) ^ (1 << (where[last + 1][j + 1] - 1))) &
               (1 << (last - 1))))
            can[i] |=
                can[i ^ (1 << last) ^ (1 << (where[last + 1][j + 1] - 1))];
        }
      }
    }
  }
  for (int i = 0; i < (1 << N); ++i)
    if (can[i | (1 << (N - 1))]) {
      int aux = (i | (1 << (N - 1))), num = 0;
      while (aux) {
        aux &= aux - 1;
        ++num;
      }
      result = min(result, num);
    }
  cout << result << '\n';
}
