## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

# [Solution] Similar Heights Codechef Solution

Chef is teaching his class of $N$ students at Hogwarts. He groups students with the same height together for an activity. Some of the students end up in a groups with only themselves and are saddened by this.

With the help of his magic wand, Chef can increase the height of any student to any value he likes. Now Chef wonders, what is the minimum number of students whose height needs to be increased so that there are no sad students?

### Input Format

• The first line of input will contain a single integer $T$, denoting the number of test cases.
Solution Click Below:-  👉
👇👇👇👇👇

• Each test case consists of two lines of input.
• The first line of each test case contains one integer $N$ — the number of students.
• The second line consists of $N$ space-separated integers ${H}_{1},{H}_{2},\dots ,{H}_{N}$ denoting the heights
•  of the students.

### Output Format

For each test case, output on a single line the minimum number of students whose heights must to be increased.

### Constraints

• $1\le T\le 5\cdot {10}^{4}$
• $2\le N\le {10}^{5}$
• $1\le {H}_{i}\le {10}^{9}$
• The sum of $N$ over all test cases won't exceed $3\cdot {10}^{5}$.