IITKWPCO - Create Collections

no tags 

  Little Feluda likes to play very much. As you know he only plays with numbers. So he is given n numbers. Now tries to group the numbers into disjoint collections each containing two numbers. He can form the collection containing two numbers iff small number in the collection is exactly half of large number.

  Given n numbers, Find out how many maximum number of collections he can form ?

Input

T: number of test cases. (1 <= T <= 100).

For each test case:

First line will contain n :  (1 <= n <= 100)

Then next line will contain n numbers single space seperated. Range of each number will be between 1 and 10^6.

Output

For each test case, output maximum number of collections that can be formed.

Example

Input:
2
2
1 2
3
1 2 4
Output:
1
1

Added by:praveen123
Date:2013-08-12
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel Pentium G860 3GHz)
Languages:All
Resource:IITK ACA CSE online judge

hide comments
rajat: 2015-08-20 20:48:28

easy one
ac in first attempt

goyal: 2015-07-19 12:39:05

AC:) using maps

ashish22_dwd: 2015-07-07 19:54:48

why i m getting WA.. plz check my code http://ideone.com/ZMNkvk

kp: 2015-07-06 09:09:42

good one, try
1
4
8 4 16 2
o/p: 2

Akshit Johry: 2015-06-04 21:19:06

AC solution...
1
4
1 2 2 1
o/p
2
something wrong o.O

shubhankaryash: 2015-06-03 17:30:14

I am getting SIGSEGV. Can someone plz tell me where the segmentation fault is?? http://ideone.com/u4ygLv

Last edit: 2015-06-03 17:37:39
kartikay singh: 2015-05-26 14:31:08

Easy AC in 1 go :D
o(n*n)passed

Anmol Pandey: 2015-01-24 23:47:37

To those getting WA or Runtime Error
1)range is not in 10^6 it is around 10^7
2)try changing cin to scanf
there isn't any trick involved.

||N0VICE||: 2014-08-18 10:16:30

No need to think too
much my n^2 soln got AC in 0.0s

Last edit: 2014-08-18 10:17:13