#include <bits/stdc++.h>
using namespace std;
void Get(int &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
int N;
int A[35];
int Log(int X) {
  int Ans = 0;
  if (X >> 16) {
    X >>= 16;
    Ans |= 16;
  }
  if (X >> 8) {
    X >>= 8;
    Ans |= 8;
  }
  if (X >> 4) {
    X >>= 4;
    Ans |= 4;
  }
  if (X >> 2) {
    X >>= 2;
    Ans |= 2;
  }
  if (X >> 1) {
    X >>= 1;
    Ans |= 1;
  }
  return Ans;
}
void Init() {
  Get(N);
  for (int i = 1; i <= N; i++) Get(A[i]);
}
vector<int> OK[105];
int F[16777225];
int Ans;
void Work() {
  for (int i = 1; i <= N; i++)
    for (int j = 1; j < i; j++)
      for (int k = j; k < i; k++) {
        if (A[j] + A[k] == A[i])
          OK[i - 1].push_back((1 << (j - 1)) | (1 << (k - 1)));
      }
  F[1] = 1;
  for (int k = 1; k < (1 << N); k++) {
    if (F[k] == 0) continue;
    int Pos = Log(k) + 1;
    bool Yes = 0;
    for (typeof(OK[Pos].begin()) i = OK[Pos].begin(); i != OK[Pos].end(); i++) {
      if ((k & (*i)) == (*i)) {
        Yes = 1;
        break;
      }
    }
    if (Yes == 0) continue;
    F[k | (1 << Pos)] = 1;
    for (int i = 0, j; i < Pos; i++) {
      j = 1 << i;
      F[(k & (~j)) | (1 << Pos)] = 1;
    }
  }
  Ans = 0x2f2f2f2f;
  for (int k = (1 << (N - 1)); k < (1 << N); k++) {
    if (F[k] == 0) continue;
    if (Ans > __builtin_popcount(k)) Ans = __builtin_popcount(k);
  }
  if (Ans >= 0x2f2f2f2f) Ans = -1;
}
void Output() { printf("%d\n", Ans); }
int main() {
  Init();
  Work();
  Output();
  return 0;
}
