inv
题号:NC17410
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Kanade has an even number n and a permutation b of all of the even numbers in [1,n]
Let a denote an array [1,3,5....n-1] , now you need to find a permutation of [1,n] satisfy both a and b are subsequence of it and minimize the number of inverse pair of it.

输入描述:

The first line has a positive even integer n

The second line has n/2 positive even integers b[i]

输出描述:

Output the number of inverse pair of the permutation you find.
示例1

输入

复制
6
2 6 4

输出

复制
2

说明

[1,2,3,5,6,4]

备注:

1≤ n≤ 2*105