# [Solution] Good Indices solution codechef

Good Indices solution codechef – Chef has an array AA of length NN.

He calls an index ii (1iN)(1≤i≤N) good if there exists some jij≠i such that Ai=AjAi=Aj.

## [Solution] Good Indices solution codechef

Chef can perform the following operation at most once:

• Choose any subsequence of the array AA and add any positive integer to all the elements of the chosen subsequence.

Determine the maximum number of good indices Chef can get.

### Input Format

• The first line of input will contain a single integer TT, denoting the number of test cases.
• Each test case consists of two lines of input.
• The first line of each test case contains a single integer NN denoting the length of the array AA.
• The second line contains NN space-separated integers denoting the array AA.

### Output Format

For each test case, output the maximum number of good indices Chef can get after performing the given operation at most once.

## [Solution] Good Indices solution codechef

• 1T5001≤T≤500
• 2N10002≤N≤1000
• 1Ai10001≤Ai≤1000
• The sum of NN over all test cases won’t exceed 20002000.

### Sample Input 1

3
6
1 3 5 2 4 8
4
2 3 4 5
7
1 1 2 2 3 4 4


### Sample Output 1

4
4
7