King's War
##### Submissions: 1912   Accuracy: 24.89%   Difficulty: Basic   Marks: 1

King is getting ready for a war. He know his strengths and weeknesses so he is taking required number of soldiers with him. King can only defeat enemies with strongest and weakest power, and one soldier can only kill one enemy. Your task is to calculate that how many soldiers are required by king to take with him for the war.

Input:
First line of input contains T, number of test cases. First line of each test case consists of a single integer N, which denotes the number of soldiers in the enemies army. Second line of each test case consists of N space separated integers A1, A2,...,An representing the of power of soldiers of enemies army.

Output:
A single integer representing the number of soldiers, king will take with him for the war.

Constraints:
1 <= T <= 100
1 <= N <= 106
1 <= Ai <= 1018

Examples
Input:

2
2
1 5
3
1 2 5

Output:
0
1

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

Contributor: Saksham Raj Seth
Author: saksham seth

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.