11101110 SUSTech Online Judge
Problem 1110 --make it sorted!

## 1110: make it sorted!

Time Limit: 3 Sec  Memory Limit: 128 MB
Submit: 8  Solved: 8
[Submit][Status][Web Board]

## Description

You are given a sequence f satisfies that fi != fj, you have an operation: swap(fi, fj) and cost you 1 Yuan, you need to calculate the minima cost to make this sequence increasing.

## Input

The first line of the input contains a integer T(T <= 10), means the number of test cases.

For each test cases, the first line is a integer N(N <= 100000), which is the length of the sequence(the absolute value of f[i] <= 2000000000, 1<=i<=n). The next line follows n integers, numbered from 1 to n.

## Output

For each given sequence, output the minima cost.

## Sample Input

1
8
8 23 4 16 77 -5 53 100


## Sample Output

5

[Submit][Status]