#include <bits/stdc++.h>
using namespace std;
int a[123456];
int n;
bool b[123456] = {0};
set<int> ma1, ma;
int main() {
  map<int, bool> M;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    M[a[i]] = false;
  }
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  M[a[0]] = true;
  for (int i = 0; i < n; i++) {
    if (!M[a[i]]) {
      cout << -1 << endl;
      return 0;
    }
    for (int j = 0; j < i + 1; j++) {
      M[a[i] + a[j]] = true;
    }
  }
  int mask = 0;
  for (int i = 1; i <= n - 1; i++) {
    ma.clear();
    ma.insert(0);
    for (int j = i + 1; j <= n; j++) {
      ma1.clear();
      for (set<int>::iterator z = ma.begin(); z != ma.end(); z++) {
        {
          for (int x1 = 0; x1 < j - 1; x1++) {
            for (int x2 = 0; x2 < j - 1; x2++) {
              if ((a[x1] + a[x2]) == a[j - 1] && !((*z) & (1 << x1)) &&
                  !((*z) & (1 << x2))) {
                goto l;
              }
            }
          }
          continue;
        l:
          if (j == n) {
            cout << i << endl;
            return 0;
          }
          for (int k = 0; k < j - 1; k++)
            if (!((*z) & (1 << k))) ma1.insert(*z | (1 << k));
        }
      }
      ma = ma1;
    }
  }
  cout << -1 << endl;
  return 0;
}
