Note
Permutation
p of length
n is the sequence that consists of
n distinct integers, each of them is from
1 to
n.
An inversion of permutation
p1,p2,...,pn is a pair of indexes
(i,j), such that
i<j and
pi>pj.
Permutation
a do not exceed permutation
b lexicographically, if either
a=b or there exists such number
i, for which the following logical condition fulfills:
AND
(ai<bi).