## GUPTA MECHANICAL

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

# [Solution] Largest Family Codechef Solution

A certain parallel universe has exactly $N$ people living in it.

The $i$-th of these $N$ people claims that they are the parent of exactly ${A}_{i}$ of these $N$ people.

However, some of these people might be lying — the $i$-th person may be either telling the truth (in which case they have exactly ${A}_{i}$ children) or lying (in which case they can have any number of children).

It is known that each person has at most one parent. Further, as one would expect, it is not allowed for a person's child to also be their ancestor.

What is the maximum possible number of truth-tellers in

Solution Click Below:-  👉
👇👇👇👇👇

this universe?

### Input Format

• The first line of input will contain a single integer $T$, 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 $N$, the number of people.
• The second line of each test case contains $N$ space-separated integers ${A}_{1},{A}_{2},\dots ,{A}_{N}$.

### Output Format

For each test case, output on a new line the maximum number of people that can be telling the truth.

### Constraints

• $1\le T\le 4\cdot {10}^{4}$