A. Twice

time limit per test

1 second

memory limit per test

256 megabytes

Kinich wakes up to the start of a new day. He turns on his phone, checks his mailbox, and finds a mysterious present. He decides to unbox the present.

Kinich unboxes an array aa with nn integers. Initially, Kinich's score is 00. He will perform the following operation any number of times:

  • Select two indices ii and jj (1≤i

Output the maximum score Kinich can achieve after performing the aforementioned operation any number of times.

Input

The first line contains an integer tt (1≤t≤5001≤t≤500) — the number of test cases.

The first line of each test case contains an integer nn (1≤n≤201≤n≤20) — the length of aa.

The following line of each test case contains nn space-separated integers a1,a2,…,ana1,a2,…,an (1≤ai≤n1≤ai≤n).

Output

For each test case, output the maximum score achievable on a new line.

Example

Input

Copy

 
  

5

1

1

2

2 2

2

1 2

4

1 2 3 1

6

1 2 3 1 2 3

Output

Copy

0
1
0
1
3

Note

In the first and third testcases, Kinich cannot perform any operations.

In the second testcase, Kinich can perform one operation with i=1i=1 and j=2j=2.

In the fourth testcase, Kinich can perform one operation with i=1i=1 and j=4j=4.

解题说明:水题,统计每个数出现的次数,然后除以2累加即可。

#include 

#define MAX_NUM 25

int main() 
{
	int n;
	int t = 0;
	int ans = 0;
	scanf("%d", &t);
	for (int k = 0; k < t; k++)
	{
		ans = 0;
		scanf("%d", &n);
		int numbers[23];
		int count[MAX_NUM] = { 0 };  

		for (int i = 0; i < n; i++)
		{
			scanf("%d", &numbers[i]);
			if (numbers[i] >= 0 && numbers[i] < MAX_NUM) 
			{
				count[numbers[i]]++; 
			}
		}

		for (int i = 0; i < MAX_NUM; i++) 
		{
			if (count[i] > 0)
			{
				ans += count[i] / 2;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

你可能感兴趣的:(AC路漫漫,算法)