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;
int n, m, i, j, k, id[1 << 20], cnt[1 << 20], f[1 << 20], g[1 << 20],
    h[1 << 20];
long long a[20], sum[1 << 20];
struct arr {
  long long x;
  int a, b;
  arr(long long _x = 0, int _a = 0, int _b = 0) { x = _x, a = _a, b = _b; }
};
int operator<(arr a, arr b) { return a.x < b.x; }
vector<arr> A[1 << 20], B[1 << 20];
void prepare() {
  for (int S = 0; S < 1 << m; S++) {
    for (int T = S; T >= 0; T = (!T) ? -1 : ((T - 1) & S))
      A[S].push_back(arr(sum[S ^ T] - sum[T], T > 0, S - T > 0));
    sort(A[S].begin(), A[S].end());
  }
  for (int S = 0; S < 1 << (n - m); S++) {
    for (int T = S; T >= 0; T = (!T) ? -1 : ((T - 1) & S))
      B[S].push_back(arr(sum[(S ^ T) << m] - sum[T << m], T > 0, S - T > 0));
    sort(B[S].begin(), B[S].end());
  }
}
int check(int S) {
  if ((sum[S] - cnt[S]) % 2 == 0) return 0;
  if (cnt[S] == 1) return 0;
  int S1 = S & ((1 << m) - 1), S2 = (S ^ S1) >> m, i, j;
  for (i = 0, j = B[S2].size() - 1; i < A[S1].size(); i++) {
    while (j > 0 && A[S1][i].x + B[S2][j - 1].x > -cnt[S]) j--;
    for (k = j; k < B[S2].size() && abs(A[S1][i].x + B[S2][k].x) < cnt[S]; k++)
      if (A[S1][i].a + B[S2][k].a && A[S1][i].b + B[S2][k].b) return 1;
  }
  return 0;
}
int main() {
  scanf("%d", &n), m = n / 2;
  for (i = 0; i < n; i++) scanf("%lld", &a[i]), id[1 << i] = i;
  for (i = 1; i < 1 << n; i++) sum[i] = sum[i ^ (i & -i)] + a[id[i & -i]];
  for (i = 1; i < 1 << n; i++) h[i] = h[i ^ (i & -i)] + (a[id[i & -i]] == 0);
  for (i = 1; i < 1 << n; i++) cnt[i] = cnt[i ^ (i & -i)] + 1;
  prepare();
  for (int S = 1; S < 1 << n; S++)
    if (!f[S] && check(S)) {
      int W = ((1 << n) - 1) ^ S;
      f[S] = 1;
      for (int T = W; T; T = (T - 1) & W) f[S | T] = max(f[S | T], f[T] + 1);
    }
  int ans = n;
  for (int S = 0; S < 1 << n; S++)
    ans = min(ans, n - f[S] - h[((1 << n) - 1) ^ S]);
  printf("%d", ans);
}