Problem: To defeat Lord Voldemort, Harry needs to destroy all horcruxes first. The last horcrux is an array a of n integers, which also needs to be destroyed. The array is considered destroyed if all its elements are zeroes. To destroy the array, Harry can perform two types of operations:

  1. choose an index i (1 ≤ i ≤ n), an integer x, and subtract x from a_i.
  2. choose two indices i and j (1 ≤ i, j ≤ n; i ≠ j), an integer x, and subtract x from a_i and x + 1 from a_j. 



Note that x does not have to be positive.

<image>

Harry is in a hurry, please help him to find the minimum number of operations required to destroy the array and exterminate Lord Voldemort.

Input

The first line contains a single integer n — the size of the array a (1 ≤ n ≤ 20). 

The following line contains n integers a_1, a_2, …, a_n — array elements (-10^{15} ≤ a_i ≤ 10^{15}).

Output

Output a single integer — the minimum number of operations required to destroy the array a.

Examples

Input


3
1 10 100


Output


3


Input


3
5 3 -2


Output


2


Input


1
0


Output


0

Note

In the first example one can just apply the operation of the first kind three times.

In the second example, one can apply the operation of the second kind two times: first, choose i = 2, j = 1, x = 4, it transforms the array into (0, -1, -2), and then choose i = 3, j = 2, x = -2 to destroy the array.

In the third example, there is nothing to be done, since the array is already destroyed.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
inline void fast_subset_zeta_transform(vector<T>& f) {
  for (int i = 0, n = 31 - __builtin_clz((int)f.size()), MSK = 1 << n; i < n;
       i++)
    for (int msk = 0; msk < MSK; msk++)
      if (msk >> i & 1) f[msk] += f[msk ^ 1 << i];
}
template <typename T>
inline void fast_subset_mobius_transform(vector<T>& f) {
  for (int i = 0, n = 31 - __builtin_clz((int)f.size()), MSK = 1 << n; i < n;
       i++)
    for (int msk = 0; msk < MSK; msk++)
      if (msk >> i & 1) f[msk] -= f[msk ^ 1 << i];
}
template <typename T>
inline void fast_superset_zeta_transform(vector<T>& f) {
  for (int i = 0, n = 31 - __builtin_clz((int)f.size()), MSK = 1 << n; i < n;
       i++)
    for (int msk = 0; msk < MSK; msk++)
      if (msk >> i & 1) f[msk ^ 1 << i] += f[msk];
}
void solve() {
  int n;
  cin >> n;
  vector<ll> a;
  for (int _ = 0; _ < n; _++) {
    ll x;
    cin >> x;
    if (x != 0) a.push_back(x);
  }
  n = a.size();
  if (n == 0) {
    cout << 0;
    return;
  } else if (n == 1) {
    cout << 1;
    return;
  }
  const int MSK = 1 << n;
  vector<ll> sum(MSK);
  for (int i = 0; i < n; i++) {
    sum[1 << i] = a[i];
  }
  fast_subset_zeta_transform(sum);
  vector<bool> good(MSK);
  int m = n / 2;
  const int LO = 1 << m;
  for (int hi = 0; hi < MSK; hi += LO) {
    vector<ll> ds;
    for (int sub = (hi - 1) & hi; sub >= 1; (sub -= 1) &= hi) {
      ds.push_back(sum[sub] - sum[sub ^ hi]);
    }
    sort(ds.begin(), ds.end());
    for (int lo = 0; lo < LO; lo++) {
      int nodes = __builtin_popcount(hi | lo);
      if ((sum[hi | lo] + nodes - 1) % 2 != 0) continue;
      bool yes = false;
      for (int sub = lo; sub >= 0; (sub -= 1) &= lo) {
        ll d = sum[sub] - sum[sub ^ lo];
        if (sub > 0 && sub < lo + hi && abs(d - sum[hi]) <= nodes - 1)
          yes |= true;
        if (sub < lo && sub + hi > 0 && abs(d + sum[hi]) <= nodes - 1)
          yes |= true;
        auto lb = lower_bound(ds.begin(), ds.end(), -d - (nodes - 1));
        auto ub = upper_bound(ds.begin(), ds.end(), -d + (nodes - 1));
        if (lb != ub) yes |= true;
        if (yes) {
          good[hi | lo] = true;
          break;
        }
        if (sub == 0) break;
      }
    }
  }
  vector<int> dp(MSK, 0);
  for (int msk = 1; msk < MSK; msk++) {
    for (int sub = msk; sub >= 1; (sub -= 1) &= msk) {
      dp[msk] = max(dp[msk], good[sub] + dp[msk ^ sub]);
    }
  }
  cout << (n - dp[MSK - 1]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  cout << endl;
}