*****************************************************************************
*       www.FindStat.org - The Combinatorial Statistic Finder               *
*                                                                           *
*       Copyright (C) 2019 The FindStatCrew <info@findstat.org>             *
*                                                                           *
*    This information is distributed in the hope that it will be useful,    *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   *
*****************************************************************************

-----------------------------------------------------------------------------
Statistic identifier: St000055

-----------------------------------------------------------------------------
Collection: Permutations

-----------------------------------------------------------------------------
Description: The inversion sum of a permutation.

A pair $a < b$ is an inversion of a permutation $\pi$ if $\pi(a) > \pi(b)$. The inversion sum is given by $\sum(b-a)$ over all inversions of $\pi$.

This is also half of the metric associated with Spearmans coefficient of association $\rho$, $\sum_i (\pi_i - i)^2$, see [5].

This is also equal to the total number of occurrences of the classical permutation patterns $[2,1], [2, 3, 1], [3, 1, 2]$, and $[3, 2, 1]$, see [2].

This is also equal to the rank of the permutation inside the alternating sign matrix lattice, see references [2] and [3].
This lattice is the MacNeille completion of the strong Bruhat order on the symmetric group [1], which means it is the smallest lattice containing the Bruhat order as a subposet.  This is a distributive lattice, so the rank of each element is given by the cardinality of the associated order ideal.  The rank is calculated by summing the entries of the corresponding ''monotone triangle'' and subtracting $\binom{n+2}{3}$, which is the sum of the entries of the monotone triangle corresponding to the identity permutation of $n$.

This is also the number of bigrassmannian permutations (that is, permutations with exactly one left descent and one right descent) below a given permutation $\pi$ in Bruhat order, see Theorem 1 of [6].



-----------------------------------------------------------------------------
References: [1]   Lascoux, A., Schützenberger, M.-P. Treillis et bases des groupes de Coxeter [[MathSciNet:1395667]]
[2]   Sack, J., Úlfarsson, H. Refined inversion statistics on permutations [[MathSciNet:2880660]] [[arXiv:1106.1995]]
[3]   Striker, J. A unifying poset perspective on alternating sign matrices, plane partitions, Catalan objects, tournaments, and tableaux [[MathSciNet:2794039]]
[4]   a(n) = the total number of permutations (m(1),m(2),m(3)...m(j)) of (1,2,3,...,j) where n = 1*m(1) + 2*m(2) + 3*m(3) + ...+j*m(j), where j is over all positive integers. [[OEIS:A135298]]
[5]   Diaconis, P., Graham, R. L. Spearman's footrule as a measure of disarray [[MathSciNet:0652736]]
[6]   Kobayashi, M. Enumeration of bigrassmannian permutations below a permutation in Bruhat order [[arXiv:1005.3335]]

-----------------------------------------------------------------------------
Code:
def statistic(pi):
    return sum( inv[1]-inv[0] for inv in pi.inversions() )

def statistic_alternative(perm):
    pmatrix = perm.to_matrix()
    w = AlternatingSignMatrix(pmatrix).to_monotone_triangle()
    counter = -binomial(len(perm)+2,3)
    for k in [0..(len(w)-1)]:
        for j in [0..(len(w[k])-1)]:
            counter=counter+w[k][j]
    return counter
    

-----------------------------------------------------------------------------
Statistic values:

[1]           => 0
[1,2]         => 0
[2,1]         => 1
[1,2,3]       => 0
[1,3,2]       => 1
[2,1,3]       => 1
[2,3,1]       => 3
[3,1,2]       => 3
[3,2,1]       => 4
[1,2,3,4]     => 0
[1,2,4,3]     => 1
[1,3,2,4]     => 1
[1,3,4,2]     => 3
[1,4,2,3]     => 3
[1,4,3,2]     => 4
[2,1,3,4]     => 1
[2,1,4,3]     => 2
[2,3,1,4]     => 3
[2,3,4,1]     => 6
[2,4,1,3]     => 5
[2,4,3,1]     => 7
[3,1,2,4]     => 3
[3,1,4,2]     => 5
[3,2,1,4]     => 4
[3,2,4,1]     => 7
[3,4,1,2]     => 8
[3,4,2,1]     => 9
[4,1,2,3]     => 6
[4,1,3,2]     => 7
[4,2,1,3]     => 7
[4,2,3,1]     => 9
[4,3,1,2]     => 9
[4,3,2,1]     => 10
[1,2,3,4,5]   => 0
[1,2,3,5,4]   => 1
[1,2,4,3,5]   => 1
[1,2,4,5,3]   => 3
[1,2,5,3,4]   => 3
[1,2,5,4,3]   => 4
[1,3,2,4,5]   => 1
[1,3,2,5,4]   => 2
[1,3,4,2,5]   => 3
[1,3,4,5,2]   => 6
[1,3,5,2,4]   => 5
[1,3,5,4,2]   => 7
[1,4,2,3,5]   => 3
[1,4,2,5,3]   => 5
[1,4,3,2,5]   => 4
[1,4,3,5,2]   => 7
[1,4,5,2,3]   => 8
[1,4,5,3,2]   => 9
[1,5,2,3,4]   => 6
[1,5,2,4,3]   => 7
[1,5,3,2,4]   => 7
[1,5,3,4,2]   => 9
[1,5,4,2,3]   => 9
[1,5,4,3,2]   => 10
[2,1,3,4,5]   => 1
[2,1,3,5,4]   => 2
[2,1,4,3,5]   => 2
[2,1,4,5,3]   => 4
[2,1,5,3,4]   => 4
[2,1,5,4,3]   => 5
[2,3,1,4,5]   => 3
[2,3,1,5,4]   => 4
[2,3,4,1,5]   => 6
[2,3,4,5,1]   => 10
[2,3,5,1,4]   => 8
[2,3,5,4,1]   => 11
[2,4,1,3,5]   => 5
[2,4,1,5,3]   => 7
[2,4,3,1,5]   => 7
[2,4,3,5,1]   => 11
[2,4,5,1,3]   => 11
[2,4,5,3,1]   => 13
[2,5,1,3,4]   => 8
[2,5,1,4,3]   => 9
[2,5,3,1,4]   => 10
[2,5,3,4,1]   => 13
[2,5,4,1,3]   => 12
[2,5,4,3,1]   => 14
[3,1,2,4,5]   => 3
[3,1,2,5,4]   => 4
[3,1,4,2,5]   => 5
[3,1,4,5,2]   => 8
[3,1,5,2,4]   => 7
[3,1,5,4,2]   => 9
[3,2,1,4,5]   => 4
[3,2,1,5,4]   => 5
[3,2,4,1,5]   => 7
[3,2,4,5,1]   => 11
[3,2,5,1,4]   => 9
[3,2,5,4,1]   => 12
[3,4,1,2,5]   => 8
[3,4,1,5,2]   => 11
[3,4,2,1,5]   => 9
[3,4,2,5,1]   => 13
[3,4,5,1,2]   => 15
[3,4,5,2,1]   => 16
[3,5,1,2,4]   => 11
[3,5,1,4,2]   => 13
[3,5,2,1,4]   => 12
[3,5,2,4,1]   => 15
[3,5,4,1,2]   => 16
[3,5,4,2,1]   => 17
[4,1,2,3,5]   => 6
[4,1,2,5,3]   => 8
[4,1,3,2,5]   => 7
[4,1,3,5,2]   => 10
[4,1,5,2,3]   => 11
[4,1,5,3,2]   => 12
[4,2,1,3,5]   => 7
[4,2,1,5,3]   => 9
[4,2,3,1,5]   => 9
[4,2,3,5,1]   => 13
[4,2,5,1,3]   => 13
[4,2,5,3,1]   => 15
[4,3,1,2,5]   => 9
[4,3,1,5,2]   => 12
[4,3,2,1,5]   => 10
[4,3,2,5,1]   => 14
[4,3,5,1,2]   => 16
[4,3,5,2,1]   => 17
[4,5,1,2,3]   => 15
[4,5,1,3,2]   => 16
[4,5,2,1,3]   => 16
[4,5,2,3,1]   => 18
[4,5,3,1,2]   => 18
[4,5,3,2,1]   => 19
[5,1,2,3,4]   => 10
[5,1,2,4,3]   => 11
[5,1,3,2,4]   => 11
[5,1,3,4,2]   => 13
[5,1,4,2,3]   => 13
[5,1,4,3,2]   => 14
[5,2,1,3,4]   => 11
[5,2,1,4,3]   => 12
[5,2,3,1,4]   => 13
[5,2,3,4,1]   => 16
[5,2,4,1,3]   => 15
[5,2,4,3,1]   => 17
[5,3,1,2,4]   => 13
[5,3,1,4,2]   => 15
[5,3,2,1,4]   => 14
[5,3,2,4,1]   => 17
[5,3,4,1,2]   => 18
[5,3,4,2,1]   => 19
[5,4,1,2,3]   => 16
[5,4,1,3,2]   => 17
[5,4,2,1,3]   => 17
[5,4,2,3,1]   => 19
[5,4,3,1,2]   => 19
[5,4,3,2,1]   => 20
[1,2,3,4,5,6] => 0
[1,2,3,4,6,5] => 1
[1,2,3,5,4,6] => 1
[1,2,3,5,6,4] => 3
[1,2,3,6,4,5] => 3
[1,2,3,6,5,4] => 4
[1,2,4,3,5,6] => 1
[1,2,4,3,6,5] => 2
[1,2,4,5,3,6] => 3
[1,2,4,5,6,3] => 6
[1,2,4,6,3,5] => 5
[1,2,4,6,5,3] => 7
[1,2,5,3,4,6] => 3
[1,2,5,3,6,4] => 5
[1,2,5,4,3,6] => 4
[1,2,5,4,6,3] => 7
[1,2,5,6,3,4] => 8
[1,2,5,6,4,3] => 9
[1,2,6,3,4,5] => 6
[1,2,6,3,5,4] => 7
[1,2,6,4,3,5] => 7
[1,2,6,4,5,3] => 9
[1,2,6,5,3,4] => 9
[1,2,6,5,4,3] => 10
[1,3,2,4,5,6] => 1
[1,3,2,4,6,5] => 2
[1,3,2,5,4,6] => 2
[1,3,2,5,6,4] => 4
[1,3,2,6,4,5] => 4
[1,3,2,6,5,4] => 5
[1,3,4,2,5,6] => 3
[1,3,4,2,6,5] => 4
[1,3,4,5,2,6] => 6
[1,3,4,5,6,2] => 10
[1,3,4,6,2,5] => 8
[1,3,4,6,5,2] => 11
[1,3,5,2,4,6] => 5
[1,3,5,2,6,4] => 7
[1,3,5,4,2,6] => 7
[1,3,5,4,6,2] => 11
[1,3,5,6,2,4] => 11
[1,3,5,6,4,2] => 13
[1,3,6,2,4,5] => 8
[1,3,6,2,5,4] => 9
[1,3,6,4,2,5] => 10
[1,3,6,4,5,2] => 13
[1,3,6,5,2,4] => 12
[1,3,6,5,4,2] => 14
[1,4,2,3,5,6] => 3
[1,4,2,3,6,5] => 4
[1,4,2,5,3,6] => 5
[1,4,2,5,6,3] => 8
[1,4,2,6,3,5] => 7
[1,4,2,6,5,3] => 9
[1,4,3,2,5,6] => 4
[1,4,3,2,6,5] => 5
[1,4,3,5,2,6] => 7
[1,4,3,5,6,2] => 11
[1,4,3,6,2,5] => 9
[1,4,3,6,5,2] => 12
[1,4,5,2,3,6] => 8
[1,4,5,2,6,3] => 11
[1,4,5,3,2,6] => 9
[1,4,5,3,6,2] => 13
[1,4,5,6,2,3] => 15
[1,4,5,6,3,2] => 16
[1,4,6,2,3,5] => 11
[1,4,6,2,5,3] => 13
[1,4,6,3,2,5] => 12
[1,4,6,3,5,2] => 15
[1,4,6,5,2,3] => 16
[1,4,6,5,3,2] => 17
[1,5,2,3,4,6] => 6
[1,5,2,3,6,4] => 8
[1,5,2,4,3,6] => 7
[1,5,2,4,6,3] => 10
[1,5,2,6,3,4] => 11
[1,5,2,6,4,3] => 12
[1,5,3,2,4,6] => 7
[1,5,3,2,6,4] => 9
[1,5,3,4,2,6] => 9
[1,5,3,4,6,2] => 13
[1,5,3,6,2,4] => 13
[1,5,3,6,4,2] => 15
[1,5,4,2,3,6] => 9
[1,5,4,2,6,3] => 12
[1,5,4,3,2,6] => 10
[1,5,4,3,6,2] => 14
[1,5,4,6,2,3] => 16
[1,5,4,6,3,2] => 17
[1,5,6,2,3,4] => 15
[1,5,6,2,4,3] => 16
[1,5,6,3,2,4] => 16
[1,5,6,3,4,2] => 18
[1,5,6,4,2,3] => 18
[1,5,6,4,3,2] => 19
[1,6,2,3,4,5] => 10
[1,6,2,3,5,4] => 11
[1,6,2,4,3,5] => 11
[1,6,2,4,5,3] => 13
[1,6,2,5,3,4] => 13
[1,6,2,5,4,3] => 14
[1,6,3,2,4,5] => 11
[1,6,3,2,5,4] => 12
[1,6,3,4,2,5] => 13
[1,6,3,4,5,2] => 16
[1,6,3,5,2,4] => 15
[1,6,3,5,4,2] => 17
[1,6,4,2,3,5] => 13
[1,6,4,2,5,3] => 15
[1,6,4,3,2,5] => 14
[1,6,4,3,5,2] => 17
[1,6,4,5,2,3] => 18
[1,6,4,5,3,2] => 19
[1,6,5,2,3,4] => 16
[1,6,5,2,4,3] => 17
[1,6,5,3,2,4] => 17
[1,6,5,3,4,2] => 19
[1,6,5,4,2,3] => 19
[1,6,5,4,3,2] => 20
[2,1,3,4,5,6] => 1
[2,1,3,4,6,5] => 2
[2,1,3,5,4,6] => 2
[2,1,3,5,6,4] => 4
[2,1,3,6,4,5] => 4
[2,1,3,6,5,4] => 5
[2,1,4,3,5,6] => 2
[2,1,4,3,6,5] => 3
[2,1,4,5,3,6] => 4
[2,1,4,5,6,3] => 7
[2,1,4,6,3,5] => 6
[2,1,4,6,5,3] => 8
[2,1,5,3,4,6] => 4
[2,1,5,3,6,4] => 6
[2,1,5,4,3,6] => 5
[2,1,5,4,6,3] => 8
[2,1,5,6,3,4] => 9
[2,1,5,6,4,3] => 10
[2,1,6,3,4,5] => 7
[2,1,6,3,5,4] => 8
[2,1,6,4,3,5] => 8
[2,1,6,4,5,3] => 10
[2,1,6,5,3,4] => 10
[2,1,6,5,4,3] => 11
[2,3,1,4,5,6] => 3
[2,3,1,4,6,5] => 4
[2,3,1,5,4,6] => 4
[2,3,1,5,6,4] => 6
[2,3,1,6,4,5] => 6
[2,3,1,6,5,4] => 7
[2,3,4,1,5,6] => 6
[2,3,4,1,6,5] => 7
[2,3,4,5,1,6] => 10
[2,3,4,5,6,1] => 15
[2,3,4,6,1,5] => 12
[2,3,4,6,5,1] => 16
[2,3,5,1,4,6] => 8
[2,3,5,1,6,4] => 10
[2,3,5,4,1,6] => 11
[2,3,5,4,6,1] => 16
[2,3,5,6,1,4] => 15
[2,3,5,6,4,1] => 18
[2,3,6,1,4,5] => 11
[2,3,6,1,5,4] => 12
[2,3,6,4,1,5] => 14
[2,3,6,4,5,1] => 18
[2,3,6,5,1,4] => 16
[2,3,6,5,4,1] => 19
[2,4,1,3,5,6] => 5
[2,4,1,3,6,5] => 6
[2,4,1,5,3,6] => 7
[2,4,1,5,6,3] => 10
[2,4,1,6,3,5] => 9
[2,4,1,6,5,3] => 11
[2,4,3,1,5,6] => 7
[2,4,3,1,6,5] => 8
[2,4,3,5,1,6] => 11
[2,4,3,5,6,1] => 16
[2,4,3,6,1,5] => 13
[2,4,3,6,5,1] => 17
[2,4,5,1,3,6] => 11
[2,4,5,1,6,3] => 14
[2,4,5,3,1,6] => 13
[2,4,5,3,6,1] => 18
[2,4,5,6,1,3] => 19
[2,4,5,6,3,1] => 21
[2,4,6,1,3,5] => 14
[2,4,6,1,5,3] => 16
[2,4,6,3,1,5] => 16
[2,4,6,3,5,1] => 20
[2,4,6,5,1,3] => 20
[2,4,6,5,3,1] => 22
[2,5,1,3,4,6] => 8
[2,5,1,3,6,4] => 10
[2,5,1,4,3,6] => 9
[2,5,1,4,6,3] => 12
[2,5,1,6,3,4] => 13
[2,5,1,6,4,3] => 14
[2,5,3,1,4,6] => 10
[2,5,3,1,6,4] => 12
[2,5,3,4,1,6] => 13
[2,5,3,4,6,1] => 18
[2,5,3,6,1,4] => 17
[2,5,3,6,4,1] => 20
[2,5,4,1,3,6] => 12
[2,5,4,1,6,3] => 15
[2,5,4,3,1,6] => 14
[2,5,4,3,6,1] => 19
[2,5,4,6,1,3] => 20
[2,5,4,6,3,1] => 22
[2,5,6,1,3,4] => 18
[2,5,6,1,4,3] => 19
[2,5,6,3,1,4] => 20
[2,5,6,3,4,1] => 23
[2,5,6,4,1,3] => 22
[2,5,6,4,3,1] => 24
[2,6,1,3,4,5] => 12
[2,6,1,3,5,4] => 13
[2,6,1,4,3,5] => 13
[2,6,1,4,5,3] => 15
[2,6,1,5,3,4] => 15
[2,6,1,5,4,3] => 16
[2,6,3,1,4,5] => 14
[2,6,3,1,5,4] => 15
[2,6,3,4,1,5] => 17
[2,6,3,4,5,1] => 21
[2,6,3,5,1,4] => 19
[2,6,3,5,4,1] => 22
[2,6,4,1,3,5] => 16
[2,6,4,1,5,3] => 18
[2,6,4,3,1,5] => 18
[2,6,4,3,5,1] => 22
[2,6,4,5,1,3] => 22
[2,6,4,5,3,1] => 24
[2,6,5,1,3,4] => 19
[2,6,5,1,4,3] => 20
[2,6,5,3,1,4] => 21
[2,6,5,3,4,1] => 24
[2,6,5,4,1,3] => 23
[2,6,5,4,3,1] => 25
[3,1,2,4,5,6] => 3
[3,1,2,4,6,5] => 4
[3,1,2,5,4,6] => 4
[3,1,2,5,6,4] => 6
[3,1,2,6,4,5] => 6
[3,1,2,6,5,4] => 7
[3,1,4,2,5,6] => 5
[3,1,4,2,6,5] => 6
[3,1,4,5,2,6] => 8
[3,1,4,5,6,2] => 12
[3,1,4,6,2,5] => 10
[3,1,4,6,5,2] => 13
[3,1,5,2,4,6] => 7
[3,1,5,2,6,4] => 9
[3,1,5,4,2,6] => 9
[3,1,5,4,6,2] => 13
[3,1,5,6,2,4] => 13
[3,1,5,6,4,2] => 15
[3,1,6,2,4,5] => 10
[3,1,6,2,5,4] => 11
[3,1,6,4,2,5] => 12
[3,1,6,4,5,2] => 15
[3,1,6,5,2,4] => 14
[3,1,6,5,4,2] => 16
[3,2,1,4,5,6] => 4
[3,2,1,4,6,5] => 5
[3,2,1,5,4,6] => 5
[3,2,1,5,6,4] => 7
[3,2,1,6,4,5] => 7
[3,2,1,6,5,4] => 8
[3,2,4,1,5,6] => 7
[3,2,4,1,6,5] => 8
[3,2,4,5,1,6] => 11
[3,2,4,5,6,1] => 16
[3,2,4,6,1,5] => 13
[3,2,4,6,5,1] => 17
[3,2,5,1,4,6] => 9
[3,2,5,1,6,4] => 11
[3,2,5,4,1,6] => 12
[3,2,5,4,6,1] => 17
[3,2,5,6,1,4] => 16
[3,2,5,6,4,1] => 19
[3,2,6,1,4,5] => 12
[3,2,6,1,5,4] => 13
[3,2,6,4,1,5] => 15
[3,2,6,4,5,1] => 19
[3,2,6,5,1,4] => 17
[3,2,6,5,4,1] => 20
[3,4,1,2,5,6] => 8
[3,4,1,2,6,5] => 9
[3,4,1,5,2,6] => 11
[3,4,1,5,6,2] => 15
[3,4,1,6,2,5] => 13
[3,4,1,6,5,2] => 16
[3,4,2,1,5,6] => 9
[3,4,2,1,6,5] => 10
[3,4,2,5,1,6] => 13
[3,4,2,5,6,1] => 18
[3,4,2,6,1,5] => 15
[3,4,2,6,5,1] => 19
[3,4,5,1,2,6] => 15
[3,4,5,1,6,2] => 19
[3,4,5,2,1,6] => 16
[3,4,5,2,6,1] => 21
[3,4,5,6,1,2] => 24
[3,4,5,6,2,1] => 25
[3,4,6,1,2,5] => 18
[3,4,6,1,5,2] => 21
[3,4,6,2,1,5] => 19
[3,4,6,2,5,1] => 23
[3,4,6,5,1,2] => 25
[3,4,6,5,2,1] => 26
[3,5,1,2,4,6] => 11
[3,5,1,2,6,4] => 13
[3,5,1,4,2,6] => 13
[3,5,1,4,6,2] => 17
[3,5,1,6,2,4] => 17
[3,5,1,6,4,2] => 19
[3,5,2,1,4,6] => 12
[3,5,2,1,6,4] => 14
[3,5,2,4,1,6] => 15
[3,5,2,4,6,1] => 20
[3,5,2,6,1,4] => 19
[3,5,2,6,4,1] => 22
[3,5,4,1,2,6] => 16
[3,5,4,1,6,2] => 20
[3,5,4,2,1,6] => 17
[3,5,4,2,6,1] => 22
[3,5,4,6,1,2] => 25
[3,5,4,6,2,1] => 26
[3,5,6,1,2,4] => 22
[3,5,6,1,4,2] => 24
[3,5,6,2,1,4] => 23
[3,5,6,2,4,1] => 26
[3,5,6,4,1,2] => 27
[3,5,6,4,2,1] => 28
[3,6,1,2,4,5] => 15
[3,6,1,2,5,4] => 16
[3,6,1,4,2,5] => 17
[3,6,1,4,5,2] => 20
[3,6,1,5,2,4] => 19
[3,6,1,5,4,2] => 21
[3,6,2,1,4,5] => 16
[3,6,2,1,5,4] => 17
[3,6,2,4,1,5] => 19
[3,6,2,4,5,1] => 23
[3,6,2,5,1,4] => 21
[3,6,2,5,4,1] => 24
[3,6,4,1,2,5] => 20
[3,6,4,1,5,2] => 23
[3,6,4,2,1,5] => 21
[3,6,4,2,5,1] => 25
[3,6,4,5,1,2] => 27
[3,6,4,5,2,1] => 28
[3,6,5,1,2,4] => 23
[3,6,5,1,4,2] => 25
[3,6,5,2,1,4] => 24
[3,6,5,2,4,1] => 27
[3,6,5,4,1,2] => 28
[3,6,5,4,2,1] => 29
[4,1,2,3,5,6] => 6
[4,1,2,3,6,5] => 7
[4,1,2,5,3,6] => 8
[4,1,2,5,6,3] => 11
[4,1,2,6,3,5] => 10
[4,1,2,6,5,3] => 12
[4,1,3,2,5,6] => 7
[4,1,3,2,6,5] => 8
[4,1,3,5,2,6] => 10
[4,1,3,5,6,2] => 14
[4,1,3,6,2,5] => 12
[4,1,3,6,5,2] => 15
[4,1,5,2,3,6] => 11
[4,1,5,2,6,3] => 14
[4,1,5,3,2,6] => 12
[4,1,5,3,6,2] => 16
[4,1,5,6,2,3] => 18
[4,1,5,6,3,2] => 19
[4,1,6,2,3,5] => 14
[4,1,6,2,5,3] => 16
[4,1,6,3,2,5] => 15
[4,1,6,3,5,2] => 18
[4,1,6,5,2,3] => 19
[4,1,6,5,3,2] => 20
[4,2,1,3,5,6] => 7
[4,2,1,3,6,5] => 8
[4,2,1,5,3,6] => 9
[4,2,1,5,6,3] => 12
[4,2,1,6,3,5] => 11
[4,2,1,6,5,3] => 13
[4,2,3,1,5,6] => 9
[4,2,3,1,6,5] => 10
[4,2,3,5,1,6] => 13
[4,2,3,5,6,1] => 18
[4,2,3,6,1,5] => 15
[4,2,3,6,5,1] => 19
[4,2,5,1,3,6] => 13
[4,2,5,1,6,3] => 16
[4,2,5,3,1,6] => 15
[4,2,5,3,6,1] => 20
[4,2,5,6,1,3] => 21
[4,2,5,6,3,1] => 23
[4,2,6,1,3,5] => 16
[4,2,6,1,5,3] => 18
[4,2,6,3,1,5] => 18
[4,2,6,3,5,1] => 22
[4,2,6,5,1,3] => 22
[4,2,6,5,3,1] => 24
[4,3,1,2,5,6] => 9
[4,3,1,2,6,5] => 10
[4,3,1,5,2,6] => 12
[4,3,1,5,6,2] => 16
[4,3,1,6,2,5] => 14
[4,3,1,6,5,2] => 17
[4,3,2,1,5,6] => 10
[4,3,2,1,6,5] => 11
[4,3,2,5,1,6] => 14
[4,3,2,5,6,1] => 19
[4,3,2,6,1,5] => 16
[4,3,2,6,5,1] => 20
[4,3,5,1,2,6] => 16
[4,3,5,1,6,2] => 20
[4,3,5,2,1,6] => 17
[4,3,5,2,6,1] => 22
[4,3,5,6,1,2] => 25
[4,3,5,6,2,1] => 26
[4,3,6,1,2,5] => 19
[4,3,6,1,5,2] => 22
[4,3,6,2,1,5] => 20
[4,3,6,2,5,1] => 24
[4,3,6,5,1,2] => 26
[4,3,6,5,2,1] => 27
[4,5,1,2,3,6] => 15
[4,5,1,2,6,3] => 18
[4,5,1,3,2,6] => 16
[4,5,1,3,6,2] => 20
[4,5,1,6,2,3] => 22
[4,5,1,6,3,2] => 23
[4,5,2,1,3,6] => 16
[4,5,2,1,6,3] => 19
[4,5,2,3,1,6] => 18
[4,5,2,3,6,1] => 23
[4,5,2,6,1,3] => 24
[4,5,2,6,3,1] => 26
[4,5,3,1,2,6] => 18
[4,5,3,1,6,2] => 22
[4,5,3,2,1,6] => 19
[4,5,3,2,6,1] => 24
[4,5,3,6,1,2] => 27
[4,5,3,6,2,1] => 28
[4,5,6,1,2,3] => 27
[4,5,6,1,3,2] => 28
[4,5,6,2,1,3] => 28
[4,5,6,2,3,1] => 30
[4,5,6,3,1,2] => 30
[4,5,6,3,2,1] => 31
[4,6,1,2,3,5] => 19
[4,6,1,2,5,3] => 21
[4,6,1,3,2,5] => 20
[4,6,1,3,5,2] => 23
[4,6,1,5,2,3] => 24
[4,6,1,5,3,2] => 25
[4,6,2,1,3,5] => 20
[4,6,2,1,5,3] => 22
[4,6,2,3,1,5] => 22
[4,6,2,3,5,1] => 26
[4,6,2,5,1,3] => 26
[4,6,2,5,3,1] => 28
[4,6,3,1,2,5] => 22
[4,6,3,1,5,2] => 25
[4,6,3,2,1,5] => 23
[4,6,3,2,5,1] => 27
[4,6,3,5,1,2] => 29
[4,6,3,5,2,1] => 30
[4,6,5,1,2,3] => 28
[4,6,5,1,3,2] => 29
[4,6,5,2,1,3] => 29
[4,6,5,2,3,1] => 31
[4,6,5,3,1,2] => 31
[4,6,5,3,2,1] => 32
[5,1,2,3,4,6] => 10
[5,1,2,3,6,4] => 12
[5,1,2,4,3,6] => 11
[5,1,2,4,6,3] => 14
[5,1,2,6,3,4] => 15
[5,1,2,6,4,3] => 16
[5,1,3,2,4,6] => 11
[5,1,3,2,6,4] => 13
[5,1,3,4,2,6] => 13
[5,1,3,4,6,2] => 17
[5,1,3,6,2,4] => 17
[5,1,3,6,4,2] => 19
[5,1,4,2,3,6] => 13
[5,1,4,2,6,3] => 16
[5,1,4,3,2,6] => 14
[5,1,4,3,6,2] => 18
[5,1,4,6,2,3] => 20
[5,1,4,6,3,2] => 21
[5,1,6,2,3,4] => 19
[5,1,6,2,4,3] => 20
[5,1,6,3,2,4] => 20
[5,1,6,3,4,2] => 22
[5,1,6,4,2,3] => 22
[5,1,6,4,3,2] => 23
[5,2,1,3,4,6] => 11
[5,2,1,3,6,4] => 13
[5,2,1,4,3,6] => 12
[5,2,1,4,6,3] => 15
[5,2,1,6,3,4] => 16
[5,2,1,6,4,3] => 17
[5,2,3,1,4,6] => 13
[5,2,3,1,6,4] => 15
[5,2,3,4,1,6] => 16
[5,2,3,4,6,1] => 21
[5,2,3,6,1,4] => 20
[5,2,3,6,4,1] => 23
[5,2,4,1,3,6] => 15
[5,2,4,1,6,3] => 18
[5,2,4,3,1,6] => 17
[5,2,4,3,6,1] => 22
[5,2,4,6,1,3] => 23
[5,2,4,6,3,1] => 25
[5,2,6,1,3,4] => 21
[5,2,6,1,4,3] => 22
[5,2,6,3,1,4] => 23
[5,2,6,3,4,1] => 26
[5,2,6,4,1,3] => 25
[5,2,6,4,3,1] => 27
[5,3,1,2,4,6] => 13
[5,3,1,2,6,4] => 15
[5,3,1,4,2,6] => 15
[5,3,1,4,6,2] => 19
[5,3,1,6,2,4] => 19
[5,3,1,6,4,2] => 21
[5,3,2,1,4,6] => 14
[5,3,2,1,6,4] => 16
[5,3,2,4,1,6] => 17
[5,3,2,4,6,1] => 22
[5,3,2,6,1,4] => 21
[5,3,2,6,4,1] => 24
[5,3,4,1,2,6] => 18
[5,3,4,1,6,2] => 22
[5,3,4,2,1,6] => 19
[5,3,4,2,6,1] => 24
[5,3,4,6,1,2] => 27
[5,3,4,6,2,1] => 28
[5,3,6,1,2,4] => 24
[5,3,6,1,4,2] => 26
[5,3,6,2,1,4] => 25
[5,3,6,2,4,1] => 28
[5,3,6,4,1,2] => 29
[5,3,6,4,2,1] => 30
[5,4,1,2,3,6] => 16
[5,4,1,2,6,3] => 19
[5,4,1,3,2,6] => 17
[5,4,1,3,6,2] => 21
[5,4,1,6,2,3] => 23
[5,4,1,6,3,2] => 24
[5,4,2,1,3,6] => 17
[5,4,2,1,6,3] => 20
[5,4,2,3,1,6] => 19
[5,4,2,3,6,1] => 24
[5,4,2,6,1,3] => 25
[5,4,2,6,3,1] => 27
[5,4,3,1,2,6] => 19
[5,4,3,1,6,2] => 23
[5,4,3,2,1,6] => 20
[5,4,3,2,6,1] => 25
[5,4,3,6,1,2] => 28
[5,4,3,6,2,1] => 29
[5,4,6,1,2,3] => 28
[5,4,6,1,3,2] => 29
[5,4,6,2,1,3] => 29
[5,4,6,2,3,1] => 31
[5,4,6,3,1,2] => 31
[5,4,6,3,2,1] => 32
[5,6,1,2,3,4] => 24
[5,6,1,2,4,3] => 25
[5,6,1,3,2,4] => 25
[5,6,1,3,4,2] => 27
[5,6,1,4,2,3] => 27
[5,6,1,4,3,2] => 28
[5,6,2,1,3,4] => 25
[5,6,2,1,4,3] => 26
[5,6,2,3,1,4] => 27
[5,6,2,3,4,1] => 30
[5,6,2,4,1,3] => 29
[5,6,2,4,3,1] => 31
[5,6,3,1,2,4] => 27
[5,6,3,1,4,2] => 29
[5,6,3,2,1,4] => 28
[5,6,3,2,4,1] => 31
[5,6,3,4,1,2] => 32
[5,6,3,4,2,1] => 33
[5,6,4,1,2,3] => 30
[5,6,4,1,3,2] => 31
[5,6,4,2,1,3] => 31
[5,6,4,2,3,1] => 33
[5,6,4,3,1,2] => 33
[5,6,4,3,2,1] => 34
[6,1,2,3,4,5] => 15
[6,1,2,3,5,4] => 16
[6,1,2,4,3,5] => 16
[6,1,2,4,5,3] => 18
[6,1,2,5,3,4] => 18
[6,1,2,5,4,3] => 19
[6,1,3,2,4,5] => 16
[6,1,3,2,5,4] => 17
[6,1,3,4,2,5] => 18
[6,1,3,4,5,2] => 21
[6,1,3,5,2,4] => 20
[6,1,3,5,4,2] => 22
[6,1,4,2,3,5] => 18
[6,1,4,2,5,3] => 20
[6,1,4,3,2,5] => 19
[6,1,4,3,5,2] => 22
[6,1,4,5,2,3] => 23
[6,1,4,5,3,2] => 24
[6,1,5,2,3,4] => 21
[6,1,5,2,4,3] => 22
[6,1,5,3,2,4] => 22
[6,1,5,3,4,2] => 24
[6,1,5,4,2,3] => 24
[6,1,5,4,3,2] => 25
[6,2,1,3,4,5] => 16
[6,2,1,3,5,4] => 17
[6,2,1,4,3,5] => 17
[6,2,1,4,5,3] => 19
[6,2,1,5,3,4] => 19
[6,2,1,5,4,3] => 20
[6,2,3,1,4,5] => 18
[6,2,3,1,5,4] => 19
[6,2,3,4,1,5] => 21
[6,2,3,4,5,1] => 25
[6,2,3,5,1,4] => 23
[6,2,3,5,4,1] => 26
[6,2,4,1,3,5] => 20
[6,2,4,1,5,3] => 22
[6,2,4,3,1,5] => 22
[6,2,4,3,5,1] => 26
[6,2,4,5,1,3] => 26
[6,2,4,5,3,1] => 28
[6,2,5,1,3,4] => 23
[6,2,5,1,4,3] => 24
[6,2,5,3,1,4] => 25
[6,2,5,3,4,1] => 28
[6,2,5,4,1,3] => 27
[6,2,5,4,3,1] => 29
[6,3,1,2,4,5] => 18
[6,3,1,2,5,4] => 19
[6,3,1,4,2,5] => 20
[6,3,1,4,5,2] => 23
[6,3,1,5,2,4] => 22
[6,3,1,5,4,2] => 24
[6,3,2,1,4,5] => 19
[6,3,2,1,5,4] => 20
[6,3,2,4,1,5] => 22
[6,3,2,4,5,1] => 26
[6,3,2,5,1,4] => 24
[6,3,2,5,4,1] => 27
[6,3,4,1,2,5] => 23
[6,3,4,1,5,2] => 26
[6,3,4,2,1,5] => 24
[6,3,4,2,5,1] => 28
[6,3,4,5,1,2] => 30
[6,3,4,5,2,1] => 31
[6,3,5,1,2,4] => 26
[6,3,5,1,4,2] => 28
[6,3,5,2,1,4] => 27
[6,3,5,2,4,1] => 30
[6,3,5,4,1,2] => 31
[6,3,5,4,2,1] => 32
[6,4,1,2,3,5] => 21
[6,4,1,2,5,3] => 23
[6,4,1,3,2,5] => 22
[6,4,1,3,5,2] => 25
[6,4,1,5,2,3] => 26
[6,4,1,5,3,2] => 27
[6,4,2,1,3,5] => 22
[6,4,2,1,5,3] => 24
[6,4,2,3,1,5] => 24
[6,4,2,3,5,1] => 28
[6,4,2,5,1,3] => 28
[6,4,2,5,3,1] => 30
[6,4,3,1,2,5] => 24
[6,4,3,1,5,2] => 27
[6,4,3,2,1,5] => 25
[6,4,3,2,5,1] => 29
[6,4,3,5,1,2] => 31
[6,4,3,5,2,1] => 32
[6,4,5,1,2,3] => 30
[6,4,5,1,3,2] => 31
[6,4,5,2,1,3] => 31
[6,4,5,2,3,1] => 33
[6,4,5,3,1,2] => 33
[6,4,5,3,2,1] => 34
[6,5,1,2,3,4] => 25
[6,5,1,2,4,3] => 26
[6,5,1,3,2,4] => 26
[6,5,1,3,4,2] => 28
[6,5,1,4,2,3] => 28
[6,5,1,4,3,2] => 29
[6,5,2,1,3,4] => 26
[6,5,2,1,4,3] => 27
[6,5,2,3,1,4] => 28
[6,5,2,3,4,1] => 31
[6,5,2,4,1,3] => 30
[6,5,2,4,3,1] => 32
[6,5,3,1,2,4] => 28
[6,5,3,1,4,2] => 30
[6,5,3,2,1,4] => 29
[6,5,3,2,4,1] => 32
[6,5,3,4,1,2] => 33
[6,5,3,4,2,1] => 34
[6,5,4,1,2,3] => 31
[6,5,4,1,3,2] => 32
[6,5,4,2,1,3] => 32
[6,5,4,2,3,1] => 34
[6,5,4,3,1,2] => 34
[6,5,4,3,2,1] => 35

-----------------------------------------------------------------------------
Created: Mar 25, 2013 at 20:49 by Jessica Striker

-----------------------------------------------------------------------------
Last Updated: May 30, 2019 at 11:28 by Masato Kobayashi