Boboge remembers The 2021 ICPC Asia Nanjing Regional Contest, Problem D. The problem gives you an array

and asks you how many times the expression ''Swap

and

'' has been executed if you call
)
which is implemented by the following Algorithm 1.
As the algorithm looks quite like the normal bubble sort, Boboge wants you to construct a permutation of length

as the array

, so that the number of times the expression ''Swap

and

'' has been executed equals to the number of times the expression ''Swap

and

'' has been executed when we call
)
and
)
respectively.
A permutation is an array consisting of

distinct integers from

to

in arbitrary order. For example,

is a permutation, but

is not a permutation (

appears twice in the array), and

is also not a permutation (

but there is

in the array).