IITKWPCO - Create Collections

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 separated. 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 G860)
Languages:All except: ASM64
Resource:IITK ACA CSE online judge

hide comments
2014-06-30 21:11:40 Ayush Nigam
o(nlogn) and with much optimisation :D:D
2014-06-30 21:11:40 UnrealNinja
Test File is poorly created.
Integers are not single space separated. There may be more than one space between integers in the list.
2014-06-30 21:11:40 கைபுள்ள
don't divide. use multiplication cause 2 WA :(
2014-06-30 21:11:40 Bhavik
ac in 1st attempt:)
nothing new in this problem
2014-06-30 21:11:40 Prakhar Gupta
too easy.... :)
2014-06-30 21:11:40 wa
@viki
u can post your query on spoj forum
at
http://www.spoj.com/forum/

Last edit: 2013-09-03 18:58:33
2014-06-30 21:11:40 viki
python i m still getting wrong ans..plz help me..
2014-06-30 21:11:40 viki
i m getting all test cases correct still getting wa..plz help...is there any trick in this ques..?
2014-06-30 21:11:40 Karthikeyan.k
Passed all test cases...Still not AC :(
Plz help
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.