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;
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 0;
  for (; !isdigit(c); c = getchar()) f |= c == '-';
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ '0');
  if (f) x = -x;
}
template <typename T>
void write(T x, char ed = '\n') {
  if (x < 0) putchar('-'), x = -x;
  static short st[30], tp;
  do st[++tp] = x % 10, x /= 10;
  while (x);
  while (tp) putchar(st[tp--] | '0');
  putchar(ed);
}
const long long inf = 1e17;
const int N = 1305000;
long long st[23], a[23], v1[N], v2[N];
int prework(long long *v, int l, int r) {
  static long long A[N], B[N];
  int L = 1;
  v[1] = 0;
  for (int i = l; i <= r; ++i) {
    for (int j = 1; j <= L; ++j) A[j] = v[j] + st[i], B[j] = v[j] - st[i];
    int t1 = 0, t2 = 0, t = 0;
    while (t1 < L || t2 < L) {
      long long v1 = t1 >= L ? inf : A[t1 + 1];
      long long v2 = t2 >= L ? inf : B[t2 + 1];
      v1 < v2 ? (v[++t] = v1, ++t1) : (v[++t] = v2, ++t2);
    }
    L = t;
  }
  return L;
}
int f[N], n;
bool check(int s) {
  int t = 0, k = 1;
  long long sum = 0;
  for (int i = 1; i <= n; ++i)
    if (s >> i - 1 & 1) st[++t] = a[i], sum += a[i];
  if (((sum - t + 1) % 2) || t <= 1) return 0;
  int cnt = abs(sum) < t ? 3 : 1;
  int A = prework(v1, 1, t / 2), B = prework(v2, t / 2 + 1, t);
  for (int i = A; i >= 1 && cnt; --i) {
    while (k <= B && v2[k] + v1[i] < -(t - 1)) ++k;
    if (k > B) break;
    for (int tk = k; tk <= B && cnt && v2[tk] + v1[i] < t; ++tk) --cnt;
  }
  return !cnt;
}
int main() {
  read(n);
  int m = 0;
  for (int i = 1; i <= n; ++i) read(a[i]), a[i] && (a[++m] = a[i]);
  n = m;
  int lim = (1 << n) - 1;
  for (int i = 1; i <= lim; ++i)
    if (check(i) && !f[i]) {
      f[i] = 1;
      int s = lim ^ i;
      for (int t = s; t; t = (t - 1) & s) f[i | t] = max(f[i | t], f[t] + 1);
    }
  write(n - f[lim]);
  return 0;
}