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>
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
int n;
long long a[22], sum[1 << 21];
int f, g[1 << 21];
char lg[1 << 21], bt[1 << 21];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (!a[i]) i--, n--;
  }
  int st = clock();
  for (int i = 0; i <= 20; i++) lg[1 << i] = i;
  for (int s = 1; s < (1 << n); s++) {
    sum[s] = sum[s - (s & -s)] + a[lg[s & -s] + 1];
  }
  int tt = 0;
  for (int s = 1; s < (1 << n); s++) {
    int si = bt[s] = bt[s >> 1] + (s & 1), f = 0;
    for (int t = s & (s - 1); t * 2 >= s; t = (t - 1) & s) {
      long long tans = abs(sum[t] - sum[s - t]);
      if ((tans & 1) != (si & 1) && tans < si) {
        f = 1;
        break;
      }
    }
    if (f) {
      g[s] = max(g[s], 1);
      int em = (1 << n) - 1 - s;
      for (int t = em; t; t = (t - 1) & em) {
        g[s | t] = max(g[s | t], g[s] + g[t]);
      }
    }
    tt = max(tt, g[s]);
  }
  cout << n - tt << "\n";
  cerr << clock() - st;
  return 0;
}