#include <bits/stdc++.h>
using namespace std;
int dp[2][1 << 24];
int main() {
  int n, i, j, a, b, c, ans;
  long long arr[25];
  while (cin >> n) {
    for (i = 0; i < n; i++) scanf("%lld", &arr[i]);
    for (i = 0; i < 2; i++) {
      for (j = 0; j < (1 << n); j++) dp[i][j] = 1 << 29;
    }
    dp[0][1] = 1;
    for (i = 1; i < n; i++) {
      for (j = 0; j < (1 << i); j++) dp[i & 1][j] = 1 << 29;
      for (a = 0; a < i; a++) {
        for (b = a; b < i; b++) {
          if (arr[a] + arr[b] == arr[i]) {
            for (j = (1 << (i - 1)); j < (1 << i); j++) {
              if (!((j >> a) & 1) || !((j >> b) & 1)) continue;
              for (c = 0; c < i; c++) {
                if (!((j >> c) & 1)) continue;
                dp[i & 1][j ^ (1 << c) ^ (1 << i)] =
                    min(dp[i & 1][j ^ (1 << c) ^ (1 << i)], dp[i & 1 ^ 1][j]);
              }
              dp[i & 1][j ^ (1 << i)] =
                  min(dp[i & 1][j ^ (1 << i)], dp[i & 1 ^ 1][j] + 1);
            }
          }
        }
      }
    }
    ans = 1 << 29;
    for (i = 0; i < (1 << n); i++) ans = min(ans, dp[n & 1 ^ 1][i]);
    if (ans == (1 << 29))
      printf("-1\n");
    else
      printf("%d\n", ans);
  }
}
