#UnknownID25. XHXMMMl31UFZWg#-@_/
XHXMMMl31UFZWg#-@_/
Statement
Monocarp wants to throw a party. He has friends, and he wants to have at least of them at his party.
The -th friend's best friend is . All are distinct, and for every , .
Monocarp can send invitations to friends. The -th friend comes to the party if both the -th friend and the -th friend receive an invitation (note that the -th friend doesn't have to actually come to the party). Each invitation is sent to exactly one of the friends.
For example, if , and Monocarp sends invitations to the friends , then the friends will come to the party. The friend won't come since his best friend didn't receive an invitation; the friend won't come since he didn't receive an invitation.
Calculate the minimum number of invitations Monocarp has to send so that at least friends come to the party.
Format
Input
The first line contains one integer ( ) — the number of test cases.
Each test case consists of two lines:
- the first line contains one integer ( ) — the number of friends;
- the second line contains integers ( ; ; all are distinct).
Output
Print one integer — the minimum number of invitations Monocarp has to send.
Sample
3
5
3 1 2 5 4
4
2 3 4 1
2
2 1
2
3
2
相关
在下列比赛中: