#1113. Divisibility by 2^n

Divisibility by 2^n

No submission language available for this problem.

Background

Special for beginners, ^_^

Description

You are given an array of positive integers a1,a2,,ana_1,a_2,…,a_n.

Make the product of all the numbers in the array (that is, a1a2ana_1⋅a_2⋅…⋅a_n) divisible by 2n2^n.

You can perform the following operation as many times as you like:

  • select an arbitrary index ii (1in1≤i≤n) and replace the value aia_i with ai=aiia_i=a_i⋅i.

You cannot apply the operation repeatedly to a single index. In other words, all selected values of ii must be different.

Find the smallest number of operations you need to perform to make the product of all the elements in the array divisible by 2n2^n.

Note that such a set of operations does not always exist.

Format

Input

The first line of the input contains a single integer tt (1t1041≤t≤10^4) — the number test cases.

Then the descriptions of the input data sets follow.

The first line of each test case contains a single integer nn (1n21051≤n≤2⋅10^5) — the length of array aa.

The second line of each test case contains exactly nn integers: a1,a2,,ana_1,a_2,…,a_n (1ai1091≤a_i≤10^9).

It is guaranteed that the sum of nn values over all test cases in a test does not exceed 21052⋅10^5.

Output

For each test case, print the least number of operations to make the product of all numbers in the array divisible by 2n2^n. If the answer does not exist, print 1-1.

Samples

6
1
2
2
3 2
3
10 6 11
4
13 17 1 1
5
1 1 12 1 1
6
20 7 14 18 3 5
0
1
1
-1
2
1

Note

In the first test case, the product of all elements is initially 22, so no operations needed.

In the second test case, the product of elements initially equals 66. We can apply the operation for i=2i=2, and then a2a_2 becomes 22=42⋅2=4, and the product of numbers becomes 34=123⋅4=12, and this product of numbers is divided by 2n=22=42^n=2^2=4.

In the fourth test case, even if we apply all possible operations, we still cannot make the product of numbers divisible by 2n2^n — it will be (131)(172)(13)(14)=5304(13⋅1)⋅(17⋅2)⋅(1⋅3)⋅(1⋅4)=5304, which does not divide by 2n2^n=242^4=1616.

In the fifth test case, we can apply operations for ii=22 and ii=44.

Limitation

1s, 1024KiB for each test case.