Identifier
Identifier
Values
[1] => 1
[1,2] => 2
[2,1] => 0
[1,2,3] => 5
[1,3,2] => 0
[2,1,3] => 1
[2,3,1] => 0
[3,1,2] => 0
[3,2,1] => 0
[1,2,3,4] => 14
[1,2,4,3] => 0
[1,3,2,4] => 2
[1,3,4,2] => 0
[1,4,2,3] => 0
[1,4,3,2] => 0
[2,1,3,4] => 4
[2,1,4,3] => 0
[2,3,1,4] => 2
[2,3,4,1] => 0
[2,4,1,3] => 0
[2,4,3,1] => 0
[3,1,2,4] => 2
[3,1,4,2] => 0
[3,2,1,4] => 0
[3,2,4,1] => 0
[3,4,1,2] => 0
[3,4,2,1] => 0
[4,1,2,3] => 0
[4,1,3,2] => 0
[4,2,1,3] => 0
[4,2,3,1] => 0
[4,3,1,2] => 0
[4,3,2,1] => 0
[1,2,3,4,5] => 42
[1,2,3,5,4] => 0
[1,2,4,3,5] => 5
[1,2,4,5,3] => 0
[1,2,5,3,4] => 0
[1,2,5,4,3] => 0
[1,3,2,4,5] => 9
[1,3,2,5,4] => 0
[1,3,4,2,5] => 5
[1,3,4,5,2] => 0
[1,3,5,2,4] => 0
[1,3,5,4,2] => 0
[1,4,2,3,5] => 4
[1,4,2,5,3] => 0
[1,4,3,2,5] => 0
[1,4,3,5,2] => 0
[1,4,5,2,3] => 0
[1,4,5,3,2] => 0
[1,5,2,3,4] => 0
[1,5,2,4,3] => 0
[1,5,3,2,4] => 0
[1,5,3,4,2] => 0
[1,5,4,2,3] => 0
[1,5,4,3,2] => 0
[2,1,3,4,5] => 14
[2,1,3,5,4] => 0
[2,1,4,3,5] => 1
[2,1,4,5,3] => 0
[2,1,5,3,4] => 0
[2,1,5,4,3] => 0
[2,3,1,4,5] => 9
[2,3,1,5,4] => 0
[2,3,4,1,5] => 5
[2,3,4,5,1] => 0
[2,3,5,1,4] => 0
[2,3,5,4,1] => 0
[2,4,1,3,5] => 4
[2,4,1,5,3] => 0
[2,4,3,1,5] => 0
[2,4,3,5,1] => 0
[2,4,5,1,3] => 0
[2,4,5,3,1] => 0
[2,5,1,3,4] => 0
[2,5,1,4,3] => 0
[2,5,3,1,4] => 0
[2,5,3,4,1] => 0
[2,5,4,1,3] => 0
[2,5,4,3,1] => 0
[3,1,2,4,5] => 9
[3,1,2,5,4] => 0
[3,1,4,2,5] => 1
[3,1,4,5,2] => 0
[3,1,5,2,4] => 0
[3,1,5,4,2] => 0
[3,2,1,4,5] => 1
[3,2,1,5,4] => 0
[3,2,4,1,5] => 1
[3,2,4,5,1] => 0
[3,2,5,1,4] => 0
[3,2,5,4,1] => 0
[3,4,1,2,5] => 4
[3,4,1,5,2] => 0
[3,4,2,1,5] => 0
[3,4,2,5,1] => 0
[3,4,5,1,2] => 0
[3,4,5,2,1] => 0
[3,5,1,2,4] => 0
[3,5,1,4,2] => 0
[3,5,2,1,4] => 0
[3,5,2,4,1] => 0
[3,5,4,1,2] => 0
[3,5,4,2,1] => 0
[4,1,2,3,5] => 5
[4,1,2,5,3] => 0
[4,1,3,2,5] => 0
[4,1,3,5,2] => 0
[4,1,5,2,3] => 0
[4,1,5,3,2] => 0
[4,2,1,3,5] => 1
[4,2,1,5,3] => 0
[4,2,3,1,5] => 0
[4,2,3,5,1] => 0
[4,2,5,1,3] => 0
[4,2,5,3,1] => 0
[4,3,1,2,5] => 0
[4,3,1,5,2] => 0
[4,3,2,1,5] => 0
[4,3,2,5,1] => 0
[4,3,5,1,2] => 0
[4,3,5,2,1] => 0
[4,5,1,2,3] => 0
[4,5,1,3,2] => 0
[4,5,2,1,3] => 0
[4,5,2,3,1] => 0
[4,5,3,1,2] => 0
[4,5,3,2,1] => 0
[5,1,2,3,4] => 0
[5,1,2,4,3] => 0
[5,1,3,2,4] => 0
[5,1,3,4,2] => 0
[5,1,4,2,3] => 0
[5,1,4,3,2] => 0
[5,2,1,3,4] => 0
[5,2,1,4,3] => 0
[5,2,3,1,4] => 0
[5,2,3,4,1] => 0
[5,2,4,1,3] => 0
[5,2,4,3,1] => 0
[5,3,1,2,4] => 0
[5,3,1,4,2] => 0
[5,3,2,1,4] => 0
[5,3,2,4,1] => 0
[5,3,4,1,2] => 0
[5,3,4,2,1] => 0
[5,4,1,2,3] => 0
[5,4,1,3,2] => 0
[5,4,2,1,3] => 0
[5,4,2,3,1] => 0
[5,4,3,1,2] => 0
[5,4,3,2,1] => 0
[1,2,3,4,5,6] => 132
[1,2,3,4,6,5] => 0
[1,2,3,5,4,6] => 14
[1,2,3,5,6,4] => 0
[1,2,3,6,4,5] => 0
[1,2,3,6,5,4] => 0
[1,2,4,3,5,6] => 24
[1,2,4,3,6,5] => 0
[1,2,4,5,3,6] => 14
[1,2,4,5,6,3] => 0
[1,2,4,6,3,5] => 0
[1,2,4,6,5,3] => 0
[1,2,5,3,4,6] => 10
[1,2,5,3,6,4] => 0
[1,2,5,4,3,6] => 0
[1,2,5,4,6,3] => 0
[1,2,5,6,3,4] => 0
[1,2,5,6,4,3] => 0
[1,2,6,3,4,5] => 0
[1,2,6,3,5,4] => 0
[1,2,6,4,3,5] => 0
[1,2,6,4,5,3] => 0
[1,2,6,5,3,4] => 0
[1,2,6,5,4,3] => 0
[1,3,2,4,5,6] => 34
[1,3,2,4,6,5] => 0
[1,3,2,5,4,6] => 2
[1,3,2,5,6,4] => 0
[1,3,2,6,4,5] => 0
[1,3,2,6,5,4] => 0
[1,3,4,2,5,6] => 24
[1,3,4,2,6,5] => 0
[1,3,4,5,2,6] => 14
[1,3,4,5,6,2] => 0
[1,3,4,6,2,5] => 0
[1,3,4,6,5,2] => 0
[1,3,5,2,4,6] => 10
[1,3,5,2,6,4] => 0
[1,3,5,4,2,6] => 0
[1,3,5,4,6,2] => 0
[1,3,5,6,2,4] => 0
[1,3,5,6,4,2] => 0
[1,3,6,2,4,5] => 0
[1,3,6,2,5,4] => 0
[1,3,6,4,2,5] => 0
[1,3,6,4,5,2] => 0
[1,3,6,5,2,4] => 0
[1,3,6,5,4,2] => 0
[1,4,2,3,5,6] => 20
[1,4,2,3,6,5] => 0
[1,4,2,5,3,6] => 2
[1,4,2,5,6,3] => 0
[1,4,2,6,3,5] => 0
[1,4,2,6,5,3] => 0
[1,4,3,2,5,6] => 2
[1,4,3,2,6,5] => 0
[1,4,3,5,2,6] => 2
[1,4,3,5,6,2] => 0
[1,4,3,6,2,5] => 0
[1,4,3,6,5,2] => 0
[1,4,5,2,3,6] => 10
[1,4,5,2,6,3] => 0
[1,4,5,3,2,6] => 0
[1,4,5,3,6,2] => 0
[1,4,5,6,2,3] => 0
[1,4,5,6,3,2] => 0
[1,4,6,2,3,5] => 0
[1,4,6,2,5,3] => 0
[1,4,6,3,2,5] => 0
[1,4,6,3,5,2] => 0
[1,4,6,5,2,3] => 0
[1,4,6,5,3,2] => 0
[1,5,2,3,4,6] => 10
[1,5,2,3,6,4] => 0
[1,5,2,4,3,6] => 0
[1,5,2,4,6,3] => 0
[1,5,2,6,3,4] => 0
[1,5,2,6,4,3] => 0
[1,5,3,2,4,6] => 2
[1,5,3,2,6,4] => 0
[1,5,3,4,2,6] => 0
[1,5,3,4,6,2] => 0
[1,5,3,6,2,4] => 0
[1,5,3,6,4,2] => 0
[1,5,4,2,3,6] => 0
[1,5,4,2,6,3] => 0
[1,5,4,3,2,6] => 0
[1,5,4,3,6,2] => 0
[1,5,4,6,2,3] => 0
[1,5,4,6,3,2] => 0
[1,5,6,2,3,4] => 0
[1,5,6,2,4,3] => 0
[1,5,6,3,2,4] => 0
[1,5,6,3,4,2] => 0
[1,5,6,4,2,3] => 0
[1,5,6,4,3,2] => 0
[1,6,2,3,4,5] => 0
[1,6,2,3,5,4] => 0
[1,6,2,4,3,5] => 0
[1,6,2,4,5,3] => 0
[1,6,2,5,3,4] => 0
[1,6,2,5,4,3] => 0
[1,6,3,2,4,5] => 0
[1,6,3,2,5,4] => 0
[1,6,3,4,2,5] => 0
[1,6,3,4,5,2] => 0
[1,6,3,5,2,4] => 0
[1,6,3,5,4,2] => 0
[1,6,4,2,3,5] => 0
[1,6,4,2,5,3] => 0
[1,6,4,3,2,5] => 0
[1,6,4,3,5,2] => 0
[1,6,4,5,2,3] => 0
[1,6,4,5,3,2] => 0
[1,6,5,2,3,4] => 0
[1,6,5,2,4,3] => 0
[1,6,5,3,2,4] => 0
[1,6,5,3,4,2] => 0
[1,6,5,4,2,3] => 0
[1,6,5,4,3,2] => 0
[2,1,3,4,5,6] => 48
[2,1,3,4,6,5] => 0
[2,1,3,5,4,6] => 4
[2,1,3,5,6,4] => 0
[2,1,3,6,4,5] => 0
[2,1,3,6,5,4] => 0
[2,1,4,3,5,6] => 6
[2,1,4,3,6,5] => 0
[2,1,4,5,3,6] => 4
[2,1,4,5,6,3] => 0
[2,1,4,6,3,5] => 0
[2,1,4,6,5,3] => 0
[2,1,5,3,4,6] => 2
[2,1,5,3,6,4] => 0
[2,1,5,4,3,6] => 0
[2,1,5,4,6,3] => 0
[2,1,5,6,3,4] => 0
[2,1,5,6,4,3] => 0
[2,1,6,3,4,5] => 0
[2,1,6,3,5,4] => 0
[2,1,6,4,3,5] => 0
[2,1,6,4,5,3] => 0
[2,1,6,5,3,4] => 0
[2,1,6,5,4,3] => 0
[2,3,1,4,5,6] => 34
[2,3,1,4,6,5] => 0
[2,3,1,5,4,6] => 2
[2,3,1,5,6,4] => 0
[2,3,1,6,4,5] => 0
[2,3,1,6,5,4] => 0
[2,3,4,1,5,6] => 24
[2,3,4,1,6,5] => 0
[2,3,4,5,1,6] => 14
[2,3,4,5,6,1] => 0
[2,3,4,6,1,5] => 0
[2,3,4,6,5,1] => 0
[2,3,5,1,4,6] => 10
[2,3,5,1,6,4] => 0
[2,3,5,4,1,6] => 0
[2,3,5,4,6,1] => 0
[2,3,5,6,1,4] => 0
[2,3,5,6,4,1] => 0
[2,3,6,1,4,5] => 0
[2,3,6,1,5,4] => 0
[2,3,6,4,1,5] => 0
[2,3,6,4,5,1] => 0
[2,3,6,5,1,4] => 0
[2,3,6,5,4,1] => 0
[2,4,1,3,5,6] => 20
[2,4,1,3,6,5] => 0
[2,4,1,5,3,6] => 2
[2,4,1,5,6,3] => 0
[2,4,1,6,3,5] => 0
[2,4,1,6,5,3] => 0
[2,4,3,1,5,6] => 2
[2,4,3,1,6,5] => 0
[2,4,3,5,1,6] => 2
[2,4,3,5,6,1] => 0
[2,4,3,6,1,5] => 0
[2,4,3,6,5,1] => 0
[2,4,5,1,3,6] => 10
[2,4,5,1,6,3] => 0
[2,4,5,3,1,6] => 0
[2,4,5,3,6,1] => 0
[2,4,5,6,1,3] => 0
[2,4,5,6,3,1] => 0
[2,4,6,1,3,5] => 0
[2,4,6,1,5,3] => 0
[2,4,6,3,1,5] => 0
[2,4,6,3,5,1] => 0
[2,4,6,5,1,3] => 0
[2,4,6,5,3,1] => 0
[2,5,1,3,4,6] => 10
[2,5,1,3,6,4] => 0
[2,5,1,4,3,6] => 0
[2,5,1,4,6,3] => 0
[2,5,1,6,3,4] => 0
[2,5,1,6,4,3] => 0
[2,5,3,1,4,6] => 2
[2,5,3,1,6,4] => 0
[2,5,3,4,1,6] => 0
[2,5,3,4,6,1] => 0
[2,5,3,6,1,4] => 0
[2,5,3,6,4,1] => 0
[2,5,4,1,3,6] => 0
[2,5,4,1,6,3] => 0
[2,5,4,3,1,6] => 0
[2,5,4,3,6,1] => 0
[2,5,4,6,1,3] => 0
[2,5,4,6,3,1] => 0
[2,5,6,1,3,4] => 0
[2,5,6,1,4,3] => 0
[2,5,6,3,1,4] => 0
[2,5,6,3,4,1] => 0
[2,5,6,4,1,3] => 0
[2,5,6,4,3,1] => 0
[2,6,1,3,4,5] => 0
[2,6,1,3,5,4] => 0
[2,6,1,4,3,5] => 0
[2,6,1,4,5,3] => 0
[2,6,1,5,3,4] => 0
[2,6,1,5,4,3] => 0
[2,6,3,1,4,5] => 0
[2,6,3,1,5,4] => 0
[2,6,3,4,1,5] => 0
[2,6,3,4,5,1] => 0
[2,6,3,5,1,4] => 0
[2,6,3,5,4,1] => 0
[2,6,4,1,3,5] => 0
[2,6,4,1,5,3] => 0
[2,6,4,3,1,5] => 0
[2,6,4,3,5,1] => 0
[2,6,4,5,1,3] => 0
[2,6,4,5,3,1] => 0
[2,6,5,1,3,4] => 0
[2,6,5,1,4,3] => 0
[2,6,5,3,1,4] => 0
[2,6,5,3,4,1] => 0
[2,6,5,4,1,3] => 0
[2,6,5,4,3,1] => 0
[3,1,2,4,5,6] => 34
[3,1,2,4,6,5] => 0
[3,1,2,5,4,6] => 2
[3,1,2,5,6,4] => 0
[3,1,2,6,4,5] => 0
[3,1,2,6,5,4] => 0
[3,1,4,2,5,6] => 6
[3,1,4,2,6,5] => 0
[3,1,4,5,2,6] => 4
[3,1,4,5,6,2] => 0
[3,1,4,6,2,5] => 0
[3,1,4,6,5,2] => 0
[3,1,5,2,4,6] => 2
[3,1,5,2,6,4] => 0
[3,1,5,4,2,6] => 0
[3,1,5,4,6,2] => 0
[3,1,5,6,2,4] => 0
[3,1,5,6,4,2] => 0
[3,1,6,2,4,5] => 0
[3,1,6,2,5,4] => 0
[3,1,6,4,2,5] => 0
[3,1,6,4,5,2] => 0
[3,1,6,5,2,4] => 0
[3,1,6,5,4,2] => 0
[3,2,1,4,5,6] => 6
[3,2,1,4,6,5] => 0
[3,2,1,5,4,6] => 0
[3,2,1,5,6,4] => 0
[3,2,1,6,4,5] => 0
[3,2,1,6,5,4] => 0
[3,2,4,1,5,6] => 6
[3,2,4,1,6,5] => 0
[3,2,4,5,1,6] => 4
[3,2,4,5,6,1] => 0
[3,2,4,6,1,5] => 0
[3,2,4,6,5,1] => 0
[3,2,5,1,4,6] => 2
[3,2,5,1,6,4] => 0
[3,2,5,4,1,6] => 0
[3,2,5,4,6,1] => 0
[3,2,5,6,1,4] => 0
[3,2,5,6,4,1] => 0
[3,2,6,1,4,5] => 0
[3,2,6,1,5,4] => 0
[3,2,6,4,1,5] => 0
[3,2,6,4,5,1] => 0
[3,2,6,5,1,4] => 0
[3,2,6,5,4,1] => 0
[3,4,1,2,5,6] => 20
[3,4,1,2,6,5] => 0
[3,4,1,5,2,6] => 2
[3,4,1,5,6,2] => 0
[3,4,1,6,2,5] => 0
[3,4,1,6,5,2] => 0
[3,4,2,1,5,6] => 2
[3,4,2,1,6,5] => 0
[3,4,2,5,1,6] => 2
[3,4,2,5,6,1] => 0
[3,4,2,6,1,5] => 0
[3,4,2,6,5,1] => 0
[3,4,5,1,2,6] => 10
[3,4,5,1,6,2] => 0
[3,4,5,2,1,6] => 0
[3,4,5,2,6,1] => 0
[3,4,5,6,1,2] => 0
[3,4,5,6,2,1] => 0
[3,4,6,1,2,5] => 0
[3,4,6,1,5,2] => 0
[3,4,6,2,1,5] => 0
[3,4,6,2,5,1] => 0
[3,4,6,5,1,2] => 0
[3,4,6,5,2,1] => 0
[3,5,1,2,4,6] => 10
[3,5,1,2,6,4] => 0
[3,5,1,4,2,6] => 0
[3,5,1,4,6,2] => 0
[3,5,1,6,2,4] => 0
[3,5,1,6,4,2] => 0
[3,5,2,1,4,6] => 2
[3,5,2,1,6,4] => 0
[3,5,2,4,1,6] => 0
[3,5,2,4,6,1] => 0
[3,5,2,6,1,4] => 0
[3,5,2,6,4,1] => 0
[3,5,4,1,2,6] => 0
[3,5,4,1,6,2] => 0
[3,5,4,2,1,6] => 0
[3,5,4,2,6,1] => 0
[3,5,4,6,1,2] => 0
[3,5,4,6,2,1] => 0
[3,5,6,1,2,4] => 0
[3,5,6,1,4,2] => 0
[3,5,6,2,1,4] => 0
[3,5,6,2,4,1] => 0
[3,5,6,4,1,2] => 0
[3,5,6,4,2,1] => 0
[3,6,1,2,4,5] => 0
[3,6,1,2,5,4] => 0
[3,6,1,4,2,5] => 0
[3,6,1,4,5,2] => 0
[3,6,1,5,2,4] => 0
[3,6,1,5,4,2] => 0
[3,6,2,1,4,5] => 0
[3,6,2,1,5,4] => 0
[3,6,2,4,1,5] => 0
[3,6,2,4,5,1] => 0
[3,6,2,5,1,4] => 0
[3,6,2,5,4,1] => 0
[3,6,4,1,2,5] => 0
[3,6,4,1,5,2] => 0
[3,6,4,2,1,5] => 0
[3,6,4,2,5,1] => 0
[3,6,4,5,1,2] => 0
[3,6,4,5,2,1] => 0
[3,6,5,1,2,4] => 0
[3,6,5,1,4,2] => 0
[3,6,5,2,1,4] => 0
[3,6,5,2,4,1] => 0
[3,6,5,4,1,2] => 0
[3,6,5,4,2,1] => 0
[4,1,2,3,5,6] => 24
[4,1,2,3,6,5] => 0
[4,1,2,5,3,6] => 2
[4,1,2,5,6,3] => 0
[4,1,2,6,3,5] => 0
[4,1,2,6,5,3] => 0
[4,1,3,2,5,6] => 2
[4,1,3,2,6,5] => 0
[4,1,3,5,2,6] => 2
[4,1,3,5,6,2] => 0
[4,1,3,6,2,5] => 0
[4,1,3,6,5,2] => 0
[4,1,5,2,3,6] => 2
[4,1,5,2,6,3] => 0
[4,1,5,3,2,6] => 0
[4,1,5,3,6,2] => 0
[4,1,5,6,2,3] => 0
[4,1,5,6,3,2] => 0
[4,1,6,2,3,5] => 0
[4,1,6,2,5,3] => 0
[4,1,6,3,2,5] => 0
[4,1,6,3,5,2] => 0
[4,1,6,5,2,3] => 0
[4,1,6,5,3,2] => 0
[4,2,1,3,5,6] => 6
[4,2,1,3,6,5] => 0
[4,2,1,5,3,6] => 0
[4,2,1,5,6,3] => 0
[4,2,1,6,3,5] => 0
[4,2,1,6,5,3] => 0
[4,2,3,1,5,6] => 2
[4,2,3,1,6,5] => 0
[4,2,3,5,1,6] => 2
[4,2,3,5,6,1] => 0
[4,2,3,6,1,5] => 0
[4,2,3,6,5,1] => 0
[4,2,5,1,3,6] => 2
[4,2,5,1,6,3] => 0
[4,2,5,3,1,6] => 0
[4,2,5,3,6,1] => 0
[4,2,5,6,1,3] => 0
[4,2,5,6,3,1] => 0
[4,2,6,1,3,5] => 0
[4,2,6,1,5,3] => 0
[4,2,6,3,1,5] => 0
[4,2,6,3,5,1] => 0
[4,2,6,5,1,3] => 0
[4,2,6,5,3,1] => 0
[4,3,1,2,5,6] => 2
[4,3,1,2,6,5] => 0
[4,3,1,5,2,6] => 0
[4,3,1,5,6,2] => 0
[4,3,1,6,2,5] => 0
[4,3,1,6,5,2] => 0
[4,3,2,1,5,6] => 0
[4,3,2,1,6,5] => 0
[4,3,2,5,1,6] => 0
[4,3,2,5,6,1] => 0
[4,3,2,6,1,5] => 0
[4,3,2,6,5,1] => 0
[4,3,5,1,2,6] => 2
[4,3,5,1,6,2] => 0
[4,3,5,2,1,6] => 0
[4,3,5,2,6,1] => 0
[4,3,5,6,1,2] => 0
[4,3,5,6,2,1] => 0
[4,3,6,1,2,5] => 0
[4,3,6,1,5,2] => 0
[4,3,6,2,1,5] => 0
[4,3,6,2,5,1] => 0
[4,3,6,5,1,2] => 0
[4,3,6,5,2,1] => 0
[4,5,1,2,3,6] => 10
[4,5,1,2,6,3] => 0
[4,5,1,3,2,6] => 0
[4,5,1,3,6,2] => 0
[4,5,1,6,2,3] => 0
[4,5,1,6,3,2] => 0
[4,5,2,1,3,6] => 2
[4,5,2,1,6,3] => 0
[4,5,2,3,1,6] => 0
[4,5,2,3,6,1] => 0
[4,5,2,6,1,3] => 0
[4,5,2,6,3,1] => 0
[4,5,3,1,2,6] => 0
[4,5,3,1,6,2] => 0
[4,5,3,2,1,6] => 0
[4,5,3,2,6,1] => 0
[4,5,3,6,1,2] => 0
[4,5,3,6,2,1] => 0
[4,5,6,1,2,3] => 0
[4,5,6,1,3,2] => 0
[4,5,6,2,1,3] => 0
[4,5,6,2,3,1] => 0
[4,5,6,3,1,2] => 0
[4,5,6,3,2,1] => 0
[4,6,1,2,3,5] => 0
[4,6,1,2,5,3] => 0
[4,6,1,3,2,5] => 0
[4,6,1,3,5,2] => 0
[4,6,1,5,2,3] => 0
[4,6,1,5,3,2] => 0
[4,6,2,1,3,5] => 0
[4,6,2,1,5,3] => 0
[4,6,2,3,1,5] => 0
[4,6,2,3,5,1] => 0
[4,6,2,5,1,3] => 0
[4,6,2,5,3,1] => 0
[4,6,3,1,2,5] => 0
[4,6,3,1,5,2] => 0
[4,6,3,2,1,5] => 0
[4,6,3,2,5,1] => 0
[4,6,3,5,1,2] => 0
[4,6,3,5,2,1] => 0
[4,6,5,1,2,3] => 0
[4,6,5,1,3,2] => 0
[4,6,5,2,1,3] => 0
[4,6,5,2,3,1] => 0
[4,6,5,3,1,2] => 0
[4,6,5,3,2,1] => 0
[5,1,2,3,4,6] => 14
[5,1,2,3,6,4] => 0
[5,1,2,4,3,6] => 0
[5,1,2,4,6,3] => 0
[5,1,2,6,3,4] => 0
[5,1,2,6,4,3] => 0
[5,1,3,2,4,6] => 2
[5,1,3,2,6,4] => 0
[5,1,3,4,2,6] => 0
[5,1,3,4,6,2] => 0
[5,1,3,6,2,4] => 0
[5,1,3,6,4,2] => 0
[5,1,4,2,3,6] => 0
[5,1,4,2,6,3] => 0
[5,1,4,3,2,6] => 0
[5,1,4,3,6,2] => 0
[5,1,4,6,2,3] => 0
[5,1,4,6,3,2] => 0
[5,1,6,2,3,4] => 0
[5,1,6,2,4,3] => 0
[5,1,6,3,2,4] => 0
[5,1,6,3,4,2] => 0
[5,1,6,4,2,3] => 0
[5,1,6,4,3,2] => 0
[5,2,1,3,4,6] => 4
[5,2,1,3,6,4] => 0
[5,2,1,4,3,6] => 0
[5,2,1,4,6,3] => 0
[5,2,1,6,3,4] => 0
[5,2,1,6,4,3] => 0
[5,2,3,1,4,6] => 2
[5,2,3,1,6,4] => 0
[5,2,3,4,1,6] => 0
[5,2,3,4,6,1] => 0
[5,2,3,6,1,4] => 0
[5,2,3,6,4,1] => 0
[5,2,4,1,3,6] => 0
[5,2,4,1,6,3] => 0
[5,2,4,3,1,6] => 0
[5,2,4,3,6,1] => 0
[5,2,4,6,1,3] => 0
[5,2,4,6,3,1] => 0
[5,2,6,1,3,4] => 0
[5,2,6,1,4,3] => 0
[5,2,6,3,1,4] => 0
[5,2,6,3,4,1] => 0
[5,2,6,4,1,3] => 0
[5,2,6,4,3,1] => 0
[5,3,1,2,4,6] => 2
[5,3,1,2,6,4] => 0
[5,3,1,4,2,6] => 0
[5,3,1,4,6,2] => 0
[5,3,1,6,2,4] => 0
[5,3,1,6,4,2] => 0
[5,3,2,1,4,6] => 0
[5,3,2,1,6,4] => 0
[5,3,2,4,1,6] => 0
[5,3,2,4,6,1] => 0
[5,3,2,6,1,4] => 0
[5,3,2,6,4,1] => 0
[5,3,4,1,2,6] => 0
[5,3,4,1,6,2] => 0
[5,3,4,2,1,6] => 0
[5,3,4,2,6,1] => 0
[5,3,4,6,1,2] => 0
[5,3,4,6,2,1] => 0
[5,3,6,1,2,4] => 0
[5,3,6,1,4,2] => 0
[5,3,6,2,1,4] => 0
[5,3,6,2,4,1] => 0
[5,3,6,4,1,2] => 0
[5,3,6,4,2,1] => 0
[5,4,1,2,3,6] => 0
[5,4,1,2,6,3] => 0
[5,4,1,3,2,6] => 0
[5,4,1,3,6,2] => 0
[5,4,1,6,2,3] => 0
[5,4,1,6,3,2] => 0
[5,4,2,1,3,6] => 0
[5,4,2,1,6,3] => 0
[5,4,2,3,1,6] => 0
[5,4,2,3,6,1] => 0
[5,4,2,6,1,3] => 0
[5,4,2,6,3,1] => 0
[5,4,3,1,2,6] => 0
[5,4,3,1,6,2] => 0
[5,4,3,2,1,6] => 0
[5,4,3,2,6,1] => 0
[5,4,3,6,1,2] => 0
[5,4,3,6,2,1] => 0
[5,4,6,1,2,3] => 0
[5,4,6,1,3,2] => 0
[5,4,6,2,1,3] => 0
[5,4,6,2,3,1] => 0
[5,4,6,3,1,2] => 0
[5,4,6,3,2,1] => 0
[5,6,1,2,3,4] => 0
[5,6,1,2,4,3] => 0
[5,6,1,3,2,4] => 0
[5,6,1,3,4,2] => 0
[5,6,1,4,2,3] => 0
[5,6,1,4,3,2] => 0
[5,6,2,1,3,4] => 0
[5,6,2,1,4,3] => 0
[5,6,2,3,1,4] => 0
[5,6,2,3,4,1] => 0
[5,6,2,4,1,3] => 0
[5,6,2,4,3,1] => 0
[5,6,3,1,2,4] => 0
[5,6,3,1,4,2] => 0
[5,6,3,2,1,4] => 0
[5,6,3,2,4,1] => 0
[5,6,3,4,1,2] => 0
[5,6,3,4,2,1] => 0
[5,6,4,1,2,3] => 0
[5,6,4,1,3,2] => 0
[5,6,4,2,1,3] => 0
[5,6,4,2,3,1] => 0
[5,6,4,3,1,2] => 0
[5,6,4,3,2,1] => 0
[6,1,2,3,4,5] => 0
[6,1,2,3,5,4] => 0
[6,1,2,4,3,5] => 0
[6,1,2,4,5,3] => 0
[6,1,2,5,3,4] => 0
[6,1,2,5,4,3] => 0
[6,1,3,2,4,5] => 0
[6,1,3,2,5,4] => 0
[6,1,3,4,2,5] => 0
[6,1,3,4,5,2] => 0
[6,1,3,5,2,4] => 0
[6,1,3,5,4,2] => 0
[6,1,4,2,3,5] => 0
[6,1,4,2,5,3] => 0
[6,1,4,3,2,5] => 0
[6,1,4,3,5,2] => 0
[6,1,4,5,2,3] => 0
[6,1,4,5,3,2] => 0
[6,1,5,2,3,4] => 0
[6,1,5,2,4,3] => 0
[6,1,5,3,2,4] => 0
[6,1,5,3,4,2] => 0
[6,1,5,4,2,3] => 0
[6,1,5,4,3,2] => 0
[6,2,1,3,4,5] => 0
[6,2,1,3,5,4] => 0
[6,2,1,4,3,5] => 0
[6,2,1,4,5,3] => 0
[6,2,1,5,3,4] => 0
[6,2,1,5,4,3] => 0
[6,2,3,1,4,5] => 0
[6,2,3,1,5,4] => 0
[6,2,3,4,1,5] => 0
[6,2,3,4,5,1] => 0
[6,2,3,5,1,4] => 0
[6,2,3,5,4,1] => 0
[6,2,4,1,3,5] => 0
[6,2,4,1,5,3] => 0
[6,2,4,3,1,5] => 0
[6,2,4,3,5,1] => 0
[6,2,4,5,1,3] => 0
[6,2,4,5,3,1] => 0
[6,2,5,1,3,4] => 0
[6,2,5,1,4,3] => 0
[6,2,5,3,1,4] => 0
[6,2,5,3,4,1] => 0
[6,2,5,4,1,3] => 0
[6,2,5,4,3,1] => 0
[6,3,1,2,4,5] => 0
[6,3,1,2,5,4] => 0
[6,3,1,4,2,5] => 0
[6,3,1,4,5,2] => 0
[6,3,1,5,2,4] => 0
[6,3,1,5,4,2] => 0
[6,3,2,1,4,5] => 0
[6,3,2,1,5,4] => 0
[6,3,2,4,1,5] => 0
[6,3,2,4,5,1] => 0
[6,3,2,5,1,4] => 0
[6,3,2,5,4,1] => 0
[6,3,4,1,2,5] => 0
[6,3,4,1,5,2] => 0
[6,3,4,2,1,5] => 0
[6,3,4,2,5,1] => 0
[6,3,4,5,1,2] => 0
[6,3,4,5,2,1] => 0
[6,3,5,1,2,4] => 0
[6,3,5,1,4,2] => 0
[6,3,5,2,1,4] => 0
[6,3,5,2,4,1] => 0
[6,3,5,4,1,2] => 0
[6,3,5,4,2,1] => 0
[6,4,1,2,3,5] => 0
[6,4,1,2,5,3] => 0
[6,4,1,3,2,5] => 0
[6,4,1,3,5,2] => 0
[6,4,1,5,2,3] => 0
[6,4,1,5,3,2] => 0
[6,4,2,1,3,5] => 0
[6,4,2,1,5,3] => 0
[6,4,2,3,1,5] => 0
[6,4,2,3,5,1] => 0
[6,4,2,5,1,3] => 0
[6,4,2,5,3,1] => 0
[6,4,3,1,2,5] => 0
[6,4,3,1,5,2] => 0
[6,4,3,2,1,5] => 0
[6,4,3,2,5,1] => 0
[6,4,3,5,1,2] => 0
[6,4,3,5,2,1] => 0
[6,4,5,1,2,3] => 0
[6,4,5,1,3,2] => 0
[6,4,5,2,1,3] => 0
[6,4,5,2,3,1] => 0
[6,4,5,3,1,2] => 0
[6,4,5,3,2,1] => 0
[6,5,1,2,3,4] => 0
[6,5,1,2,4,3] => 0
[6,5,1,3,2,4] => 0
[6,5,1,3,4,2] => 0
[6,5,1,4,2,3] => 0
[6,5,1,4,3,2] => 0
[6,5,2,1,3,4] => 0
[6,5,2,1,4,3] => 0
[6,5,2,3,1,4] => 0
[6,5,2,3,4,1] => 0
[6,5,2,4,1,3] => 0
[6,5,2,4,3,1] => 0
[6,5,3,1,2,4] => 0
[6,5,3,1,4,2] => 0
[6,5,3,2,1,4] => 0
[6,5,3,2,4,1] => 0
[6,5,3,4,1,2] => 0
[6,5,3,4,2,1] => 0
[6,5,4,1,2,3] => 0
[6,5,4,1,3,2] => 0
[6,5,4,2,1,3] => 0
[6,5,4,2,3,1] => 0
[6,5,4,3,1,2] => 0
[6,5,4,3,2,1] => 0
[1,2,3,4,5,6,7] => 429
[1,2,3,4,5,7,6] => 0
[1,2,3,4,6,5,7] => 42
[1,2,3,4,6,7,5] => 0
[1,2,3,4,7,5,6] => 0
[1,2,3,4,7,6,5] => 0
[1,2,3,5,4,6,7] => 70
[1,2,3,5,4,7,6] => 0
[1,2,3,5,6,4,7] => 42
[1,2,3,5,6,7,4] => 0
[1,2,3,5,7,4,6] => 0
[1,2,3,5,7,6,4] => 0
[1,2,3,6,4,5,7] => 28
[1,2,3,6,4,7,5] => 0
[1,2,3,6,5,4,7] => 0
[1,2,3,6,5,7,4] => 0
[1,2,3,6,7,4,5] => 0
[1,2,3,6,7,5,4] => 0
[1,2,3,7,4,5,6] => 0
[1,2,3,7,4,6,5] => 0
[1,2,3,7,5,4,6] => 0
[1,2,3,7,5,6,4] => 0
[1,2,3,7,6,4,5] => 0
[1,2,3,7,6,5,4] => 0
[1,2,4,3,5,6,7] => 95
[1,2,4,3,5,7,6] => 0
[1,2,4,3,6,5,7] => 5
[1,2,4,3,6,7,5] => 0
[1,2,4,3,7,5,6] => 0
[1,2,4,3,7,6,5] => 0
[1,2,4,5,3,6,7] => 70
[1,2,4,5,3,7,6] => 0
[1,2,4,5,6,3,7] => 42
[1,2,4,5,6,7,3] => 0
[1,2,4,5,7,3,6] => 0
[1,2,4,5,7,6,3] => 0
[1,2,4,6,3,5,7] => 28
[1,2,4,6,3,7,5] => 0
[1,2,4,6,5,3,7] => 0
[1,2,4,6,5,7,3] => 0
[1,2,4,6,7,3,5] => 0
[1,2,4,6,7,5,3] => 0
[1,2,4,7,3,5,6] => 0
[1,2,4,7,3,6,5] => 0
[1,2,4,7,5,3,6] => 0
[1,2,4,7,5,6,3] => 0
[1,2,4,7,6,3,5] => 0
[1,2,4,7,6,5,3] => 0
[1,2,5,3,4,6,7] => 53
[1,2,5,3,4,7,6] => 0
[1,2,5,3,6,4,7] => 5
[1,2,5,3,6,7,4] => 0
[1,2,5,3,7,4,6] => 0
[1,2,5,3,7,6,4] => 0
[1,2,5,4,3,6,7] => 5
[1,2,5,4,3,7,6] => 0
[1,2,5,4,6,3,7] => 5
[1,2,5,4,6,7,3] => 0
[1,2,5,4,7,3,6] => 0
[1,2,5,4,7,6,3] => 0
[1,2,5,6,3,4,7] => 28
[1,2,5,6,3,7,4] => 0
[1,2,5,6,4,3,7] => 0
[1,2,5,6,4,7,3] => 0
[1,2,5,6,7,3,4] => 0
[1,2,5,6,7,4,3] => 0
[1,2,5,7,3,4,6] => 0
[1,2,5,7,3,6,4] => 0
[1,2,5,7,4,3,6] => 0
[1,2,5,7,4,6,3] => 0
[1,2,5,7,6,3,4] => 0
[1,2,5,7,6,4,3] => 0
[1,2,6,3,4,5,7] => 25
[1,2,6,3,4,7,5] => 0
[1,2,6,3,5,4,7] => 0
[1,2,6,3,5,7,4] => 0
[1,2,6,3,7,4,5] => 0
[1,2,6,3,7,5,4] => 0
[1,2,6,4,3,5,7] => 5
[1,2,6,4,3,7,5] => 0
[1,2,6,4,5,3,7] => 0
[1,2,6,4,5,7,3] => 0
[1,2,6,4,7,3,5] => 0
[1,2,6,4,7,5,3] => 0
[1,2,6,5,3,4,7] => 0
[1,2,6,5,3,7,4] => 0
[1,2,6,5,4,3,7] => 0
[1,2,6,5,4,7,3] => 0
[1,2,6,5,7,3,4] => 0
[1,2,6,5,7,4,3] => 0
[1,2,6,7,3,4,5] => 0
[1,2,6,7,3,5,4] => 0
[1,2,6,7,4,3,5] => 0
[1,2,6,7,4,5,3] => 0
[1,2,6,7,5,3,4] => 0
[1,2,6,7,5,4,3] => 0
[1,2,7,3,4,5,6] => 0
[1,2,7,3,4,6,5] => 0
[1,2,7,3,5,4,6] => 0
[1,2,7,3,5,6,4] => 0
[1,2,7,3,6,4,5] => 0
[1,2,7,3,6,5,4] => 0
[1,2,7,4,3,5,6] => 0
[1,2,7,4,3,6,5] => 0
[1,2,7,4,5,3,6] => 0
[1,2,7,4,5,6,3] => 0
[1,2,7,4,6,3,5] => 0
[1,2,7,4,6,5,3] => 0
[1,2,7,5,3,4,6] => 0
[1,2,7,5,3,6,4] => 0
[1,2,7,5,4,3,6] => 0
[1,2,7,5,4,6,3] => 0
[1,2,7,5,6,3,4] => 0
[1,2,7,5,6,4,3] => 0
[1,2,7,6,3,4,5] => 0
[1,2,7,6,3,5,4] => 0
[1,2,7,6,4,3,5] => 0
[1,2,7,6,4,5,3] => 0
[1,2,7,6,5,3,4] => 0
[1,2,7,6,5,4,3] => 0
[1,3,2,4,5,6,7] => 123
[1,3,2,4,5,7,6] => 0
[1,3,2,4,6,5,7] => 9
[1,3,2,4,6,7,5] => 0
[1,3,2,4,7,5,6] => 0
[1,3,2,4,7,6,5] => 0
[1,3,2,5,4,6,7] => 13
[1,3,2,5,4,7,6] => 0
[1,3,2,5,6,4,7] => 9
[1,3,2,5,6,7,4] => 0
[1,3,2,5,7,4,6] => 0
[1,3,2,5,7,6,4] => 0
[1,3,2,6,4,5,7] => 4
[1,3,2,6,4,7,5] => 0
[1,3,2,6,5,4,7] => 0
[1,3,2,6,5,7,4] => 0
[1,3,2,6,7,4,5] => 0
[1,3,2,6,7,5,4] => 0
[1,3,2,7,4,5,6] => 0
[1,3,2,7,4,6,5] => 0
[1,3,2,7,5,4,6] => 0
[1,3,2,7,5,6,4] => 0
[1,3,2,7,6,4,5] => 0
[1,3,2,7,6,5,4] => 0
[1,3,4,2,5,6,7] => 95
[1,3,4,2,5,7,6] => 0
[1,3,4,2,6,5,7] => 5
[1,3,4,2,6,7,5] => 0
[1,3,4,2,7,5,6] => 0
[1,3,4,2,7,6,5] => 0
[1,3,4,5,2,6,7] => 70
[1,3,4,5,2,7,6] => 0
[1,3,4,5,6,2,7] => 42
[1,3,4,5,6,7,2] => 0
[1,3,4,5,7,2,6] => 0
[1,3,4,5,7,6,2] => 0
[1,3,4,6,2,5,7] => 28
[1,3,4,6,2,7,5] => 0
[1,3,4,6,5,2,7] => 0
[1,3,4,6,5,7,2] => 0
[1,3,4,6,7,2,5] => 0
[1,3,4,6,7,5,2] => 0
[1,3,4,7,2,5,6] => 0
[1,3,4,7,2,6,5] => 0
[1,3,4,7,5,2,6] => 0
[1,3,4,7,5,6,2] => 0
[1,3,4,7,6,2,5] => 0
[1,3,4,7,6,5,2] => 0
[1,3,5,2,4,6,7] => 53
[1,3,5,2,4,7,6] => 0
[1,3,5,2,6,4,7] => 5
[1,3,5,2,6,7,4] => 0
[1,3,5,2,7,4,6] => 0
[1,3,5,2,7,6,4] => 0
[1,3,5,4,2,6,7] => 5
[1,3,5,4,2,7,6] => 0
[1,3,5,4,6,2,7] => 5
[1,3,5,4,6,7,2] => 0
[1,3,5,4,7,2,6] => 0
[1,3,5,4,7,6,2] => 0
[1,3,5,6,2,4,7] => 28
[1,3,5,6,2,7,4] => 0
[1,3,5,6,4,2,7] => 0
[1,3,5,6,4,7,2] => 0
[1,3,5,6,7,2,4] => 0
[1,3,5,6,7,4,2] => 0
[1,3,5,7,2,4,6] => 0
[1,3,5,7,2,6,4] => 0
[1,3,5,7,4,2,6] => 0
[1,3,5,7,4,6,2] => 0
[1,3,5,7,6,2,4] => 0
[1,3,5,7,6,4,2] => 0
[1,3,6,2,4,5,7] => 25
[1,3,6,2,4,7,5] => 0
[1,3,6,2,5,4,7] => 0
[1,3,6,2,5,7,4] => 0
[1,3,6,2,7,4,5] => 0
[1,3,6,2,7,5,4] => 0
[1,3,6,4,2,5,7] => 5
[1,3,6,4,2,7,5] => 0
[1,3,6,4,5,2,7] => 0
[1,3,6,4,5,7,2] => 0
[1,3,6,4,7,2,5] => 0
[1,3,6,4,7,5,2] => 0
[1,3,6,5,2,4,7] => 0
[1,3,6,5,2,7,4] => 0
[1,3,6,5,4,2,7] => 0
[1,3,6,5,4,7,2] => 0
[1,3,6,5,7,2,4] => 0
[1,3,6,5,7,4,2] => 0
[1,3,6,7,2,4,5] => 0
[1,3,6,7,2,5,4] => 0
[1,3,6,7,4,2,5] => 0
[1,3,6,7,4,5,2] => 0
[1,3,6,7,5,2,4] => 0
[1,3,6,7,5,4,2] => 0
[1,3,7,2,4,5,6] => 0
[1,3,7,2,4,6,5] => 0
[1,3,7,2,5,4,6] => 0
[1,3,7,2,5,6,4] => 0
[1,3,7,2,6,4,5] => 0
[1,3,7,2,6,5,4] => 0
[1,3,7,4,2,5,6] => 0
[1,3,7,4,2,6,5] => 0
[1,3,7,4,5,2,6] => 0
[1,3,7,4,5,6,2] => 0
[1,3,7,4,6,2,5] => 0
[1,3,7,4,6,5,2] => 0
[1,3,7,5,2,4,6] => 0
[1,3,7,5,2,6,4] => 0
[1,3,7,5,4,2,6] => 0
[1,3,7,5,4,6,2] => 0
[1,3,7,5,6,2,4] => 0
[1,3,7,5,6,4,2] => 0
[1,3,7,6,2,4,5] => 0
[1,3,7,6,2,5,4] => 0
[1,3,7,6,4,2,5] => 0
[1,3,7,6,4,5,2] => 0
[1,3,7,6,5,2,4] => 0
[1,3,7,6,5,4,2] => 0
[1,4,2,3,5,6,7] => 81
[1,4,2,3,5,7,6] => 0
[1,4,2,3,6,5,7] => 4
[1,4,2,3,6,7,5] => 0
[1,4,2,3,7,5,6] => 0
[1,4,2,3,7,6,5] => 0
[1,4,2,5,3,6,7] => 13
[1,4,2,5,3,7,6] => 0
[1,4,2,5,6,3,7] => 9
[1,4,2,5,6,7,3] => 0
[1,4,2,5,7,3,6] => 0
[1,4,2,5,7,6,3] => 0
[1,4,2,6,3,5,7] => 4
[1,4,2,6,3,7,5] => 0
[1,4,2,6,5,3,7] => 0
[1,4,2,6,5,7,3] => 0
[1,4,2,6,7,3,5] => 0
[1,4,2,6,7,5,3] => 0
[1,4,2,7,3,5,6] => 0
[1,4,2,7,3,6,5] => 0
[1,4,2,7,5,3,6] => 0
[1,4,2,7,5,6,3] => 0
[1,4,2,7,6,3,5] => 0
[1,4,2,7,6,5,3] => 0
[1,4,3,2,5,6,7] => 13
[1,4,3,2,5,7,6] => 0
[1,4,3,2,6,5,7] => 0
[1,4,3,2,6,7,5] => 0
[1,4,3,2,7,5,6] => 0
[1,4,3,2,7,6,5] => 0
[1,4,3,5,2,6,7] => 13
[1,4,3,5,2,7,6] => 0
[1,4,3,5,6,2,7] => 9
[1,4,3,5,6,7,2] => 0
[1,4,3,5,7,2,6] => 0
[1,4,3,5,7,6,2] => 0
[1,4,3,6,2,5,7] => 4
[1,4,3,6,2,7,5] => 0
[1,4,3,6,5,2,7] => 0
[1,4,3,6,5,7,2] => 0
[1,4,3,6,7,2,5] => 0
[1,4,3,6,7,5,2] => 0
[1,4,3,7,2,5,6] => 0
[1,4,3,7,2,6,5] => 0
[1,4,3,7,5,2,6] => 0
[1,4,3,7,5,6,2] => 0
[1,4,3,7,6,2,5] => 0
[1,4,3,7,6,5,2] => 0
[1,4,5,2,3,6,7] => 53
[1,4,5,2,3,7,6] => 0
[1,4,5,2,6,3,7] => 5
[1,4,5,2,6,7,3] => 0
[1,4,5,2,7,3,6] => 0
[1,4,5,2,7,6,3] => 0
[1,4,5,3,2,6,7] => 5
[1,4,5,3,2,7,6] => 0
[1,4,5,3,6,2,7] => 5
[1,4,5,3,6,7,2] => 0
[1,4,5,3,7,2,6] => 0
[1,4,5,3,7,6,2] => 0
[1,4,5,6,2,3,7] => 28
[1,4,5,6,2,7,3] => 0
[1,4,5,6,3,2,7] => 0
[1,4,5,6,3,7,2] => 0
[1,4,5,6,7,2,3] => 0
[1,4,5,6,7,3,2] => 0
[1,4,5,7,2,3,6] => 0
[1,4,5,7,2,6,3] => 0
[1,4,5,7,3,2,6] => 0
[1,4,5,7,3,6,2] => 0
[1,4,5,7,6,2,3] => 0
[1,4,5,7,6,3,2] => 0
[1,4,6,2,3,5,7] => 25
[1,4,6,2,3,7,5] => 0
[1,4,6,2,5,3,7] => 0
[1,4,6,2,5,7,3] => 0
[1,4,6,2,7,3,5] => 0
[1,4,6,2,7,5,3] => 0
[1,4,6,3,2,5,7] => 5
[1,4,6,3,2,7,5] => 0
[1,4,6,3,5,2,7] => 0
[1,4,6,3,5,7,2] => 0
[1,4,6,3,7,2,5] => 0
[1,4,6,3,7,5,2] => 0
[1,4,6,5,2,3,7] => 0
[1,4,6,5,2,7,3] => 0
[1,4,6,5,3,2,7] => 0
click to show generating function       
Description
The fertility of a permutation.
This is the size of the preimage of a permutation $\pi$ under the stack-sorting map $s$ defined by Julian West.
For a partial permutation $\pi = \pi_1 \cdots \pi_n$ define $s(\pi)$ recursively as follows:
  • If the $n\leq 1$ set $s(\pi) = \pi$.
  • Otherwise, let $m$ be the largest entry in $\pi$, write $\pi=LmR$ and define $s(\pi) = s(L)s(R)m$.
References
[1] West, J. Permutations with forbidden subsequences and stack-sortable permutations MathSciNet:2716312
[2] Defant, C. Fertility Numbers arXiv:1809.04421
Code
def stacksort(perm):
    perm = list(perm)
    if len(perm) <= 1:
        return perm
    n = max(perm)
    i_n = perm.index(n)
    L = perm[:i_n]
    R = perm[i_n+1:]
    return stacksort(L) + stacksort(R) + [n]

@cached_function
def fertility_Sn(n):
    stack_sorted = dict()
    S_n = Permutations(n)
    for perm in S_n:
        stack_sorted[perm] = list()
    for perm in S_n:
        stack_sorted[Permutation(stacksort(perm))].append(perm)
    fertility = dict()
    for perm in S_n:
        fertility[perm]=len(stack_sorted[perm])
    return fertility


def statistic(x):
    return fertility_Sn(len(x))[x]

Created
Apr 15, 2019 at 14:08 by Tilman Moeller
Updated
Jan 17, 2020 at 00:29 by Martin Rubey