Chetan and Shiv are good friends. Both of them are having their own pack of N cards numbered from 1 to N. Shiv puts his cards in a row in order from 1 to N. Chetan being hyperactive puts his cards in another row, but in random order. Now he challenges Shiv to Make Shiv's row of cards exactly similar to Chetan's.
In one step, Shiv can pick one card from its current position, another one from another position and then exchange their positions.
Shiv decides to Accept this challenge. But he wants to do this in minimum number of moves as he has to create problems for his event C-BAY .
INPUT:
The first line of input consists of a single integer T denoting number of test cases.
The first line of each of folowing test case consists of a single integer N denoting the number of cards in each of the pack.
The next line of the test case consists of N space separated integers denoting the arrangement of Chetan's cards.
OUTPUT:
For each test case, print a single integer Cmin denoting minimum number of moves Shiv will have make to make to change arrangement of his cards to the given permutation.
CONSTRAINTS:
1 ≤ T ≤ 10000
1 ≤ N ≤ 200
1 ≤ Ai ≤ N
, for all 1 ≤ i ≤ N, all the Ai are distinct.
In the first case we need to convert 1 2 to 1 2 which can be done in zero steps
In second test case we have to convert 1 2 3 4 to 2 3 4 1, one way to do so is 1 2 3 4 ---> 2 1 3 4 ----> 2 3 1 4 ----> 2 3 4 1
Similarly In third test case 1 2 3 4 5 to 2 4 3 1 5, this can be done as 1 2 3 4 5---> 1 4 3 2 5 ---> 2 4 3 1 5
All the participants need to register on the given link: goo.gl/MDh9FR