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.
#include <bits/stdc++.h>
inline void up(int &x, const int y) { x < y ? x = y : 0; }
const int N = 20, M1 = 1 << 20, M2 = 1 << 10;
int n, m, ans;
long long a[N], b[N], s1[M2], s2[M2];
int f[M1], g[M1], pw[5][M1];
int x[N + 1][M1], y[N + 1][M1], z[N + 1][M1];
inline bool check(int msk) {
  long long sum = 0;
  m = 0;
  for (int i = 0; i < n; ++i)
    if (msk >> i & 1) b[m++] = a[i], sum += a[i];
  if ((sum + m) % 2 == 0) return false;
  int n1 = m / 2, n2 = m - n1, t1 = 1 << n1, t2 = 1 << n2;
  s1[0] = s2[0] = 0;
  for (int i = 1, x; i < t1; ++i)
    x = __builtin_ctz(i), s1[i] = s1[i ^ (1 << x)] + b[x];
  for (int i = 1, x; i < t2; ++i)
    x = __builtin_ctz(i), s2[i] = s2[i ^ (1 << x)] + b[n1 + x];
  long long L = (sum - --m) / 2, R = (sum + m) / 2;
  auto in = [&](long long x) { return L <= x && x <= R; };
  for (int i = 1; i < t1; ++i)
    if (in(s1[i])) return true;
  for (int i = 1; i < t2; ++i)
    if (in(s2[i])) return true;
  for (int i = 0; i < t1 - 1; ++i)
    if (in(s2[t2 - 1] + s1[i])) return true;
  for (int i = 0; i < t2 - 1; ++i)
    if (in(s1[t1 - 1] + s2[i])) return true;
  std::sort(s1, s1 + t1), std::sort(s2, s2 + t2);
  for (int i = t1 - 2, l = 1, r = 1; i; --i) {
    while (l < t2 && s1[i] + s2[l] < L) ++l;
    while (r < t2 && s1[i] + s2[r] <= R) ++r;
    if (r - l > 0) return true;
  }
  return false;
}
inline void FMT(int *a) {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 1 << n; ++j)
      if (j >> i & 1) a[j] += a[j ^ (1 << i)];
}
inline void IFMT(int *a) {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < 1 << n; ++j)
      if (j >> i & 1) a[j] -= a[j ^ (1 << i)];
}
inline void Mul(const bool f[], const bool g[], bool *h) {
  memset(x, 0, sizeof(x)), memset(y, 0, sizeof(y)), memset(z, 0, sizeof(z));
  for (int s = 0; s < 1 << n; ++s)
    x[__builtin_popcount(s)][s] = f[s], y[__builtin_popcount(s)][s] = g[s];
  for (int i = 0; i <= n; ++i) FMT(x[i]), FMT(y[i]);
  for (int i = 0; i <= n; ++i)
    for (int s = 0; s < 1 << n; ++s) {
      for (int j = 0; j <= i; ++j) z[i][s] += x[j][s] * y[i - j][s];
    }
  for (int i = 0; i <= n; ++i) IFMT(z[i]);
  for (int s = 0; s < 1 << n; ++s) h[s] = bool(z[__builtin_popcount(s)][s]);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]), (!a[i]) && (--n, --i);
  for (int s = 0; s < 1 << n; ++s)
    if (__builtin_popcount(s) > 1) f[s] = pw[0][s] = check(s);
  for (int s = 0; s < 1 << n; ++s)
    for (int t = s; t; t = (t - 1) & s) up(f[s], f[t] + f[s ^ t]);
  printf("%d\n", n - f[(1 << n) - 1]);
}
