Timer is Running

Love For The Twins
Submissions: 6349   Accuracy:


  Difficulty: Easy   Marks: 2

Suppose you have two pets and you love both of them very much. You go to a pet store to buy different articles for your pets. But you ask salesman that you will buy only those articles which are actually in pair. In this store, articles are referred as integers. So you have to tell total no. of articles you will buy for your pets.

Note: Time complexity O(n).

Input : 
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Second line contains the no. of articles "N" shown by the salesman.Third line contains N - separated integers describing the articles referred as an integer.

Output : 
Total No. of articles you will prefer to buy for your pets.

1 ≤ T ≤ 200
1 ≤ N ≤ 1000
1 ≤ A[N] ≤ 1000

Example : 
Input : 

10 10 10 20 20 10 20

Output :

The pairs formed are: (10,10) (10,10) (20,20). The leftover 10 can't be paired with any other 10.
Hence, the total articles we'll buy are 6. 


** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Mohit Gupta :)
Author: Mohit Gupta 4

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.