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;
long long a[25];
int n, ac[1 << 20];
long long w1[1 << 20], w2[1 << 20], now1[1 << 20], now2[1 << 20], now3[1 << 20],
    sk[25];
void solve(long long *w, int l, int r) {
  int sz = 1;
  now1[sz] = 0;
  for (int i = l; i <= r; ++i) {
    for (int j = 1; j <= sz; ++j)
      now2[j] = now1[j] + sk[i], now3[j] = now1[j] - sk[i];
    int tot = 0, l = 1, r = 1;
    while (l <= sz && r <= sz) {
      if (now2[l] <= now3[r])
        now1[++tot] = now2[l++];
      else
        now1[++tot] = now3[r++];
    }
    while (l <= sz) now1[++tot] = now2[l++];
    while (r <= sz) now1[++tot] = now3[r++];
    sz = tot;
  }
  for (int i = 1; i <= sz; ++i) w[i] = now1[i];
}
bool check(int x) {
  int tot = 0;
  long long w = 0;
  for (int i = 0; i < n; ++i)
    if ((1 << i) & x) sk[++tot] = a[i + 1], w += a[i + 1];
  if ((w - (tot - 1)) & 1) return 0;
  solve(w1, 1, tot / 2);
  solve(w2, tot / 2 + 1, tot);
  int n = 1 << (tot / 2), m = 1 << (tot - tot / 2), r = 1,
      fk = 1 + (abs(w) < tot) * 2;
  for (int i = n; i >= 1; --i) {
    while (r <= m && w1[i] + w2[r] < -(tot - 1)) ++r;
    for (int j = r; j <= m && fk && w1[i] + w2[j] < tot; ++j) fk--;
  }
  return !fk;
}
int main() {
  scanf("%d", &n);
  int cs = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
    if (a[i]) a[++cs] = a[i];
  }
  n = cs;
  int len = 1 << n;
  for (int i = 1; i < len; ++i)
    if (!ac[i] && check(i)) {
      ac[i] = 1;
      int t = (len - 1) ^ i;
      for (int j = t; j; j = (j - 1) & t)
        ac[i | j] = max(ac[i | j], ac[i] + ac[j]);
    }
  printf("%d", n - ac[len - 1]);
}