3234. Sort

单点时限: 4.0 sec

内存限制: 256 MB

You want to process a sequence of $n$ distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order.

输入格式

There are several test cases, please process till EOF.

For each test case, the first line contains integer $n$ $(1 \leq n \leq 10^5)$. The second line contains $n$ space-separated integers $a_1, a_2, \ldots, a_n$ $(1 \leq a_i \leq 10^9)$.

输出格式

For each test case, output the minimum times of swapping in one line.

样例

Input
2
1 2
Output
0

197 人解决,291 人已尝试。

249 份提交通过,共有 1428 份提交。

3.6 EMB 奖励。

创建: 3 年,5 月前.

修改: 3 年,2 月前.

最后提交: 4 天,9 小时前.

来源: 2017 华东理工上海高校邀请赛

题目标签