Identifier
Identifier
Values
[1] => 0
[1,2] => 0
[2,1] => 0
[1,2,3] => 1
[1,3,2] => 2
[2,1,3] => 2
[2,3,1] => 2
[3,1,2] => 2
[3,2,1] => 1
[1,2,3,4] => 5
[1,2,4,3] => 8
[1,3,2,4] => 9
[1,3,4,2] => 9
[1,4,2,3] => 10
[1,4,3,2] => 9
[2,1,3,4] => 8
[2,1,4,3] => 11
[2,3,1,4] => 10
[2,3,4,1] => 9
[2,4,1,3] => 11
[2,4,3,1] => 9
[3,1,2,4] => 9
[3,1,4,2] => 11
[3,2,1,4] => 9
[3,2,4,1] => 10
[3,4,1,2] => 11
[3,4,2,1] => 8
[4,1,2,3] => 9
[4,1,3,2] => 10
[4,2,1,3] => 9
[4,2,3,1] => 9
[4,3,1,2] => 8
[4,3,2,1] => 5
[1,2,3,4,5] => 16
[1,2,3,5,4] => 23
[1,2,4,3,5] => 26
[1,2,4,5,3] => 26
[1,2,5,3,4] => 29
[1,2,5,4,3] => 28
[1,3,2,4,5] => 26
[1,3,2,5,4] => 33
[1,3,4,2,5] => 30
[1,3,4,5,2] => 27
[1,3,5,2,4] => 33
[1,3,5,4,2] => 29
[1,4,2,3,5] => 30
[1,4,2,5,3] => 34
[1,4,3,2,5] => 32
[1,4,3,5,2] => 33
[1,4,5,2,3] => 34
[1,4,5,3,2] => 29
[1,5,2,3,4] => 31
[1,5,2,4,3] => 34
[1,5,3,2,4] => 33
[1,5,3,4,2] => 33
[1,5,4,2,3] => 32
[1,5,4,3,2] => 27
[2,1,3,4,5] => 23
[2,1,3,5,4] => 30
[2,1,4,3,5] => 33
[2,1,4,5,3] => 33
[2,1,5,3,4] => 36
[2,1,5,4,3] => 35
[2,3,1,4,5] => 29
[2,3,1,5,4] => 36
[2,3,4,1,5] => 31
[2,3,4,5,1] => 27
[2,3,5,1,4] => 34
[2,3,5,4,1] => 29
[2,4,1,3,5] => 33
[2,4,1,5,3] => 37
[2,4,3,1,5] => 33
[2,4,3,5,1] => 33
[2,4,5,1,3] => 35
[2,4,5,3,1] => 29
[2,5,1,3,4] => 34
[2,5,1,4,3] => 37
[2,5,3,1,4] => 34
[2,5,3,4,1] => 33
[2,5,4,1,3] => 33
[2,5,4,3,1] => 27
[3,1,2,4,5] => 26
[3,1,2,5,4] => 33
[3,1,4,2,5] => 34
[3,1,4,5,2] => 33
[3,1,5,2,4] => 37
[3,1,5,4,2] => 35
[3,2,1,4,5] => 28
[3,2,1,5,4] => 35
[3,2,4,1,5] => 34
[3,2,4,5,1] => 32
[3,2,5,1,4] => 37
[3,2,5,4,1] => 34
[3,4,1,2,5] => 34
[3,4,1,5,2] => 37
[3,4,2,1,5] => 32
[3,4,2,5,1] => 34
[3,4,5,1,2] => 35
[3,4,5,2,1] => 28
[3,5,1,2,4] => 35
[3,5,1,4,2] => 37
[3,5,2,1,4] => 33
[3,5,2,4,1] => 34
[3,5,4,1,2] => 33
[3,5,4,2,1] => 26
[4,1,2,3,5] => 27
[4,1,2,5,3] => 33
[4,1,3,2,5] => 33
[4,1,3,5,2] => 34
[4,1,5,2,3] => 37
[4,1,5,3,2] => 34
[4,2,1,3,5] => 29
[4,2,1,5,3] => 35
[4,2,3,1,5] => 33
[4,2,3,5,1] => 33
[4,2,5,1,3] => 37
[4,2,5,3,1] => 33
[4,3,1,2,5] => 29
[4,3,1,5,2] => 34
[4,3,2,1,5] => 27
[4,3,2,5,1] => 31
[4,3,5,1,2] => 36
[4,3,5,2,1] => 29
[4,5,1,2,3] => 35
[4,5,1,3,2] => 36
[4,5,2,1,3] => 33
[4,5,2,3,1] => 33
[4,5,3,1,2] => 30
[4,5,3,2,1] => 23
[5,1,2,3,4] => 27
[5,1,2,4,3] => 32
[5,1,3,2,4] => 33
[5,1,3,4,2] => 33
[5,1,4,2,3] => 34
[5,1,4,3,2] => 31
[5,2,1,3,4] => 29
[5,2,1,4,3] => 34
[5,2,3,1,4] => 33
[5,2,3,4,1] => 32
[5,2,4,1,3] => 34
[5,2,4,3,1] => 30
[5,3,1,2,4] => 29
[5,3,1,4,2] => 33
[5,3,2,1,4] => 27
[5,3,2,4,1] => 30
[5,3,4,1,2] => 33
[5,3,4,2,1] => 26
[5,4,1,2,3] => 28
[5,4,1,3,2] => 29
[5,4,2,1,3] => 26
[5,4,2,3,1] => 26
[5,4,3,1,2] => 23
[5,4,3,2,1] => 16
[1,2,3,4,5,6] => 42
[1,2,3,4,6,5] => 57
[1,2,3,5,4,6] => 64
[1,2,3,5,6,4] => 64
[1,2,3,6,4,5] => 71
[1,2,3,6,5,4] => 70
[1,2,4,3,5,6] => 66
[1,2,4,3,6,5] => 81
[1,2,4,5,3,6] => 74
[1,2,4,5,6,3] => 67
[1,2,4,6,3,5] => 81
[1,2,4,6,5,3] => 73
[1,2,5,3,4,6] => 76
[1,2,5,3,6,4] => 84
[1,2,5,4,3,6] => 82
[1,2,5,4,6,3] => 83
[1,2,5,6,3,4] => 84
[1,2,5,6,4,3] => 75
[1,2,6,3,4,5] => 79
[1,2,6,3,5,4] => 86
[1,2,6,4,3,5] => 85
[1,2,6,4,5,3] => 85
[1,2,6,5,3,4] => 84
[1,2,6,5,4,3] => 75
[1,3,2,4,5,6] => 64
[1,3,2,4,6,5] => 79
[1,3,2,5,4,6] => 86
[1,3,2,5,6,4] => 86
[1,3,2,6,4,5] => 93
[1,3,2,6,5,4] => 92
[1,3,4,2,5,6] => 76
[1,3,4,2,6,5] => 91
[1,3,4,5,2,6] => 78
[1,3,4,5,6,2] => 68
[1,3,4,6,2,5] => 85
[1,3,4,6,5,2] => 74
[1,3,5,2,4,6] => 86
[1,3,5,2,6,4] => 94
[1,3,5,4,2,6] => 86
[1,3,5,4,6,2] => 84
[1,3,5,6,2,4] => 88
[1,3,5,6,4,2] => 76
[1,3,6,2,4,5] => 89
[1,3,6,2,5,4] => 96
[1,3,6,4,2,5] => 89
[1,3,6,4,5,2] => 86
[1,3,6,5,2,4] => 88
[1,3,6,5,4,2] => 76
[1,4,2,3,5,6] => 74
[1,4,2,3,6,5] => 89
[1,4,2,5,3,6] => 90
[1,4,2,5,6,3] => 87
[1,4,2,6,3,5] => 97
[1,4,2,6,5,3] => 93
[1,4,3,2,5,6] => 82
[1,4,3,2,6,5] => 97
[1,4,3,5,2,6] => 92
[1,4,3,5,6,2] => 86
[1,4,3,6,2,5] => 99
[1,4,3,6,5,2] => 92
[1,4,5,2,3,6] => 90
[1,4,5,2,6,3] => 95
[1,4,5,3,2,6] => 88
[1,4,5,3,6,2] => 90
[1,4,5,6,2,3] => 89
[1,4,5,6,3,2] => 76
[1,4,6,2,3,5] => 93
[1,4,6,2,5,3] => 97
[1,4,6,3,2,5] => 91
[1,4,6,3,5,2] => 92
[1,4,6,5,2,3] => 89
[1,4,6,5,3,2] => 76
[1,5,2,3,4,6] => 78
[1,5,2,3,6,4] => 90
[1,5,2,4,3,6] => 92
[1,5,2,4,6,3] => 93
[1,5,2,6,3,4] => 98
[1,5,2,6,4,3] => 93
[1,5,3,2,4,6] => 86
[1,5,3,2,6,4] => 98
[1,5,3,4,2,6] => 94
[1,5,3,4,6,2] => 92
[1,5,3,6,2,4] => 100
[1,5,3,6,4,2] => 92
[1,5,4,2,3,6] => 88
[1,5,4,2,6,3] => 97
[1,5,4,3,2,6] => 86
[1,5,4,3,6,2] => 92
[1,5,4,6,2,3] => 99
[1,5,4,6,3,2] => 86
[1,5,6,2,3,4] => 94
[1,5,6,2,4,3] => 97
[1,5,6,3,2,4] => 92
[1,5,6,3,4,2] => 92
[1,5,6,4,2,3] => 87
[1,5,6,4,3,2] => 74
[1,6,2,3,4,5] => 79
[1,6,2,3,5,4] => 90
[1,6,2,4,3,5] => 93
[1,6,2,4,5,3] => 93
[1,6,2,5,3,4] => 96
[1,6,2,5,4,3] => 91
[1,6,3,2,4,5] => 87
[1,6,3,2,5,4] => 98
[1,6,3,4,2,5] => 95
[1,6,3,4,5,2] => 92
[1,6,3,5,2,4] => 98
[1,6,3,5,4,2] => 90
[1,6,4,2,3,5] => 89
[1,6,4,2,5,3] => 97
[1,6,4,3,2,5] => 87
[1,6,4,3,5,2] => 92
[1,6,4,5,2,3] => 97
[1,6,4,5,3,2] => 84
[1,6,5,2,3,4] => 88
[1,6,5,2,4,3] => 91
[1,6,5,3,2,4] => 86
[1,6,5,3,4,2] => 86
[1,6,5,4,2,3] => 81
[1,6,5,4,3,2] => 68
[2,1,3,4,5,6] => 57
[2,1,3,4,6,5] => 72
[2,1,3,5,4,6] => 79
[2,1,3,5,6,4] => 79
[2,1,3,6,4,5] => 86
[2,1,3,6,5,4] => 85
[2,1,4,3,5,6] => 81
[2,1,4,3,6,5] => 96
[2,1,4,5,3,6] => 89
[2,1,4,5,6,3] => 82
[2,1,4,6,3,5] => 96
[2,1,4,6,5,3] => 88
[2,1,5,3,4,6] => 91
[2,1,5,3,6,4] => 99
[2,1,5,4,3,6] => 97
[2,1,5,4,6,3] => 98
[2,1,5,6,3,4] => 99
[2,1,5,6,4,3] => 90
[2,1,6,3,4,5] => 94
[2,1,6,3,5,4] => 101
[2,1,6,4,3,5] => 100
[2,1,6,4,5,3] => 100
[2,1,6,5,3,4] => 99
[2,1,6,5,4,3] => 90
[2,3,1,4,5,6] => 71
[2,3,1,4,6,5] => 86
[2,3,1,5,4,6] => 93
[2,3,1,5,6,4] => 93
[2,3,1,6,4,5] => 100
[2,3,1,6,5,4] => 99
[2,3,4,1,5,6] => 79
[2,3,4,1,6,5] => 94
[2,3,4,5,1,6] => 79
[2,3,4,5,6,1] => 68
[2,3,4,6,1,5] => 86
[2,3,4,6,5,1] => 74
[2,3,5,1,4,6] => 89
[2,3,5,1,6,4] => 97
[2,3,5,4,1,6] => 87
[2,3,5,4,6,1] => 84
[2,3,5,6,1,4] => 89
[2,3,5,6,4,1] => 76
[2,3,6,1,4,5] => 92
[2,3,6,1,5,4] => 99
[2,3,6,4,1,5] => 90
[2,3,6,4,5,1] => 86
[2,3,6,5,1,4] => 89
[2,3,6,5,4,1] => 76
[2,4,1,3,5,6] => 81
[2,4,1,3,6,5] => 96
[2,4,1,5,3,6] => 97
[2,4,1,5,6,3] => 94
[2,4,1,6,3,5] => 104
[2,4,1,6,5,3] => 100
[2,4,3,1,5,6] => 85
[2,4,3,1,6,5] => 100
[2,4,3,5,1,6] => 93
[2,4,3,5,6,1] => 86
[2,4,3,6,1,5] => 100
[2,4,3,6,5,1] => 92
[2,4,5,1,3,6] => 93
[2,4,5,1,6,3] => 98
[2,4,5,3,1,6] => 89
[2,4,5,3,6,1] => 90
[2,4,5,6,1,3] => 90
[2,4,5,6,3,1] => 76
[2,4,6,1,3,5] => 96
[2,4,6,1,5,3] => 100
[2,4,6,3,1,5] => 92
[2,4,6,3,5,1] => 92
[2,4,6,5,1,3] => 90
[2,4,6,5,3,1] => 76
[2,5,1,3,4,6] => 85
[2,5,1,3,6,4] => 97
[2,5,1,4,3,6] => 99
[2,5,1,4,6,3] => 100
[2,5,1,6,3,4] => 105
[2,5,1,6,4,3] => 100
[2,5,3,1,4,6] => 89
[2,5,3,1,6,4] => 101
[2,5,3,4,1,6] => 95
[2,5,3,4,6,1] => 92
[2,5,3,6,1,4] => 101
[2,5,3,6,4,1] => 92
[2,5,4,1,3,6] => 91
[2,5,4,1,6,3] => 100
[2,5,4,3,1,6] => 87
[2,5,4,3,6,1] => 92
[2,5,4,6,1,3] => 100
[2,5,4,6,3,1] => 86
[2,5,6,1,3,4] => 97
[2,5,6,1,4,3] => 100
[2,5,6,3,1,4] => 93
[2,5,6,3,4,1] => 92
[2,5,6,4,1,3] => 88
[2,5,6,4,3,1] => 74
[2,6,1,3,4,5] => 86
[2,6,1,3,5,4] => 97
[2,6,1,4,3,5] => 100
[2,6,1,4,5,3] => 100
[2,6,1,5,3,4] => 103
[2,6,1,5,4,3] => 98
[2,6,3,1,4,5] => 90
[2,6,3,1,5,4] => 101
[2,6,3,4,1,5] => 96
[2,6,3,4,5,1] => 92
[2,6,3,5,1,4] => 99
[2,6,3,5,4,1] => 90
[2,6,4,1,3,5] => 92
[2,6,4,1,5,3] => 100
[2,6,4,3,1,5] => 88
[2,6,4,3,5,1] => 92
[2,6,4,5,1,3] => 98
[2,6,4,5,3,1] => 84
[2,6,5,1,3,4] => 91
[2,6,5,1,4,3] => 94
[2,6,5,3,1,4] => 87
[2,6,5,3,4,1] => 86
[2,6,5,4,1,3] => 82
[2,6,5,4,3,1] => 68
[3,1,2,4,5,6] => 64
[3,1,2,4,6,5] => 79
[3,1,2,5,4,6] => 86
[3,1,2,5,6,4] => 86
[3,1,2,6,4,5] => 93
[3,1,2,6,5,4] => 92
[3,1,4,2,5,6] => 84
[3,1,4,2,6,5] => 99
[3,1,4,5,2,6] => 90
[3,1,4,5,6,2] => 82
[3,1,4,6,2,5] => 97
[3,1,4,6,5,2] => 88
[3,1,5,2,4,6] => 94
[3,1,5,2,6,4] => 102
[3,1,5,4,2,6] => 98
[3,1,5,4,6,2] => 98
[3,1,5,6,2,4] => 100
[3,1,5,6,4,2] => 90
[3,1,6,2,4,5] => 97
[3,1,6,2,5,4] => 104
[3,1,6,4,2,5] => 101
[3,1,6,4,5,2] => 100
[3,1,6,5,2,4] => 100
[3,1,6,5,4,2] => 90
[3,2,1,4,5,6] => 70
[3,2,1,4,6,5] => 85
[3,2,1,5,4,6] => 92
[3,2,1,5,6,4] => 92
[3,2,1,6,4,5] => 99
[3,2,1,6,5,4] => 98
[3,2,4,1,5,6] => 86
[3,2,4,1,6,5] => 101
[3,2,4,5,1,6] => 90
[3,2,4,5,6,1] => 81
[3,2,4,6,1,5] => 97
[3,2,4,6,5,1] => 87
[3,2,5,1,4,6] => 96
[3,2,5,1,6,4] => 104
[3,2,5,4,1,6] => 98
[3,2,5,4,6,1] => 97
[3,2,5,6,1,4] => 100
[3,2,5,6,4,1] => 89
[3,2,6,1,4,5] => 99
[3,2,6,1,5,4] => 106
[3,2,6,4,1,5] => 101
[3,2,6,4,5,1] => 99
[3,2,6,5,1,4] => 100
[3,2,6,5,4,1] => 89
[3,4,1,2,5,6] => 84
[3,4,1,2,6,5] => 99
[3,4,1,5,2,6] => 98
[3,4,1,5,6,2] => 94
[3,4,1,6,2,5] => 105
[3,4,1,6,5,2] => 100
[3,4,2,1,5,6] => 84
[3,4,2,1,6,5] => 99
[3,4,2,5,1,6] => 96
[3,4,2,5,6,1] => 91
[3,4,2,6,1,5] => 103
[3,4,2,6,5,1] => 97
[3,4,5,1,2,6] => 94
[3,4,5,1,6,2] => 98
[3,4,5,2,1,6] => 88
[3,4,5,2,6,1] => 91
[3,4,5,6,1,2] => 90
[3,4,5,6,2,1] => 75
[3,4,6,1,2,5] => 97
[3,4,6,1,5,2] => 100
[3,4,6,2,1,5] => 91
[3,4,6,2,5,1] => 93
[3,4,6,5,1,2] => 90
[3,4,6,5,2,1] => 75
[3,5,1,2,4,6] => 88
[3,5,1,2,6,4] => 100
[3,5,1,4,2,6] => 100
[3,5,1,4,6,2] => 100
[3,5,1,6,2,4] => 106
[3,5,1,6,4,2] => 100
[3,5,2,1,4,6] => 88
[3,5,2,1,6,4] => 100
[3,5,2,4,1,6] => 98
[3,5,2,4,6,1] => 97
[3,5,2,6,1,4] => 104
[3,5,2,6,4,1] => 97
[3,5,4,1,2,6] => 92
[3,5,4,1,6,2] => 100
[3,5,4,2,1,6] => 86
[3,5,4,2,6,1] => 93
[3,5,4,6,1,2] => 100
[3,5,4,6,2,1] => 85
[3,5,6,1,2,4] => 98
[3,5,6,1,4,2] => 100
[3,5,6,2,1,4] => 92
[3,5,6,2,4,1] => 93
[3,5,6,4,1,2] => 88
[3,5,6,4,2,1] => 73
[3,6,1,2,4,5] => 89
[3,6,1,2,5,4] => 100
[3,6,1,4,2,5] => 101
[3,6,1,4,5,2] => 100
[3,6,1,5,2,4] => 104
[3,6,1,5,4,2] => 98
[3,6,2,1,4,5] => 89
[3,6,2,1,5,4] => 100
[3,6,2,4,1,5] => 99
[3,6,2,4,5,1] => 97
[3,6,2,5,1,4] => 102
[3,6,2,5,4,1] => 95
[3,6,4,1,2,5] => 93
[3,6,4,1,5,2] => 100
[3,6,4,2,1,5] => 87
[3,6,4,2,5,1] => 93
[3,6,4,5,1,2] => 98
[3,6,4,5,2,1] => 83
[3,6,5,1,2,4] => 92
[3,6,5,1,4,2] => 94
[3,6,5,2,1,4] => 86
[3,6,5,2,4,1] => 87
[3,6,5,4,1,2] => 82
[3,6,5,4,2,1] => 67
[4,1,2,3,5,6] => 67
[4,1,2,3,6,5] => 82
[4,1,2,5,3,6] => 87
[4,1,2,5,6,3] => 86
[4,1,2,6,3,5] => 94
[4,1,2,6,5,3] => 92
[4,1,3,2,5,6] => 83
[4,1,3,2,6,5] => 98
[4,1,3,5,2,6] => 93
[4,1,3,5,6,2] => 87
[4,1,3,6,2,5] => 100
[4,1,3,6,5,2] => 93
[4,1,5,2,3,6] => 95
[4,1,5,2,6,3] => 102
[4,1,5,3,2,6] => 97
[4,1,5,3,6,2] => 99
[4,1,5,6,2,3] => 100
[4,1,5,6,3,2] => 89
[4,1,6,2,3,5] => 98
[4,1,6,2,5,3] => 104
[4,1,6,3,2,5] => 100
[4,1,6,3,5,2] => 101
[4,1,6,5,2,3] => 100
[4,1,6,5,3,2] => 89
[4,2,1,3,5,6] => 73
[4,2,1,3,6,5] => 88
[4,2,1,5,3,6] => 93
[4,2,1,5,6,3] => 92
[4,2,1,6,3,5] => 100
[4,2,1,6,5,3] => 98
[4,2,3,1,5,6] => 85
[4,2,3,1,6,5] => 100
[4,2,3,5,1,6] => 93
[4,2,3,5,6,1] => 86
[4,2,3,6,1,5] => 100
[4,2,3,6,5,1] => 92
[4,2,5,1,3,6] => 97
[4,2,5,1,6,3] => 104
[4,2,5,3,1,6] => 97
[4,2,5,3,6,1] => 98
[4,2,5,6,1,3] => 100
[4,2,5,6,3,1] => 88
[4,2,6,1,3,5] => 100
[4,2,6,1,5,3] => 106
[4,2,6,3,1,5] => 100
[4,2,6,3,5,1] => 100
[4,2,6,5,1,3] => 100
[4,2,6,5,3,1] => 88
[4,3,1,2,5,6] => 75
[4,3,1,2,6,5] => 90
[4,3,1,5,2,6] => 93
[4,3,1,5,6,2] => 91
[4,3,1,6,2,5] => 100
[4,3,1,6,5,2] => 97
[4,3,2,1,5,6] => 75
[4,3,2,1,6,5] => 90
[4,3,2,5,1,6] => 91
[4,3,2,5,6,1] => 88
[4,3,2,6,1,5] => 98
[4,3,2,6,5,1] => 94
[4,3,5,1,2,6] => 97
[4,3,5,1,6,2] => 103
[4,3,5,2,1,6] => 91
[4,3,5,2,6,1] => 96
[4,3,5,6,1,2] => 99
[4,3,5,6,2,1] => 84
[4,3,6,1,2,5] => 100
[4,3,6,1,5,2] => 105
[4,3,6,2,1,5] => 94
[4,3,6,2,5,1] => 98
[4,3,6,5,1,2] => 99
[4,3,6,5,2,1] => 84
[4,5,1,2,3,6] => 89
[4,5,1,2,6,3] => 100
[4,5,1,3,2,6] => 99
[4,5,1,3,6,2] => 101
[4,5,1,6,2,3] => 106
[4,5,1,6,3,2] => 99
[4,5,2,1,3,6] => 89
[4,5,2,1,6,3] => 100
[4,5,2,3,1,6] => 97
[4,5,2,3,6,1] => 98
[4,5,2,6,1,3] => 104
[4,5,2,6,3,1] => 96
[4,5,3,1,2,6] => 87
[4,5,3,1,6,2] => 97
[4,5,3,2,1,6] => 81
[4,5,3,2,6,1] => 90
[4,5,3,6,1,2] => 101
[4,5,3,6,2,1] => 86
[4,5,6,1,2,3] => 98
[4,5,6,1,3,2] => 99
[4,5,6,2,1,3] => 92
[4,5,6,2,3,1] => 92
[4,5,6,3,1,2] => 85
[4,5,6,3,2,1] => 70
[4,6,1,2,3,5] => 90
[4,6,1,2,5,3] => 100
[4,6,1,3,2,5] => 100
[4,6,1,3,5,2] => 101
[4,6,1,5,2,3] => 104
[4,6,1,5,3,2] => 97
[4,6,2,1,3,5] => 90
[4,6,2,1,5,3] => 100
[4,6,2,3,1,5] => 98
[4,6,2,3,5,1] => 98
[4,6,2,5,1,3] => 102
[4,6,2,5,3,1] => 94
[4,6,3,1,2,5] => 88
[4,6,3,1,5,2] => 97
[4,6,3,2,1,5] => 82
[4,6,3,2,5,1] => 90
[4,6,3,5,1,2] => 99
[4,6,3,5,2,1] => 84
[4,6,5,1,2,3] => 92
[4,6,5,1,3,2] => 93
[4,6,5,2,1,3] => 86
[4,6,5,2,3,1] => 86
[4,6,5,3,1,2] => 79
[4,6,5,3,2,1] => 64
[5,1,2,3,4,6] => 68
[5,1,2,3,6,4] => 82
[5,1,2,4,3,6] => 86
[5,1,2,4,6,3] => 87
[5,1,2,6,3,4] => 94
[5,1,2,6,4,3] => 91
[5,1,3,2,4,6] => 84
[5,1,3,2,6,4] => 98
[5,1,3,4,2,6] => 92
[5,1,3,4,6,2] => 88
[5,1,3,6,2,4] => 100
[5,1,3,6,4,2] => 92
[5,1,4,2,3,6] => 90
[5,1,4,2,6,3] => 99
[5,1,4,3,2,6] => 92
[5,1,4,3,6,2] => 96
[5,1,4,6,2,3] => 101
[5,1,4,6,3,2] => 90
[5,1,6,2,3,4] => 98
[5,1,6,2,4,3] => 103
[5,1,6,3,2,4] => 100
[5,1,6,3,4,2] => 100
[5,1,6,4,2,3] => 97
[5,1,6,4,3,2] => 86
[5,2,1,3,4,6] => 74
[5,2,1,3,6,4] => 88
[5,2,1,4,3,6] => 92
[5,2,1,4,6,3] => 93
[5,2,1,6,3,4] => 100
[5,2,1,6,4,3] => 97
[5,2,3,1,4,6] => 86
[5,2,3,1,6,4] => 100
[5,2,3,4,1,6] => 92
[5,2,3,4,6,1] => 87
[5,2,3,6,1,4] => 100
[5,2,3,6,4,1] => 91
[5,2,4,1,3,6] => 92
[5,2,4,1,6,3] => 101
[5,2,4,3,1,6] => 92
[5,2,4,3,6,1] => 95
[5,2,4,6,1,3] => 101
[5,2,4,6,3,1] => 89
[5,2,6,1,3,4] => 100
[5,2,6,1,4,3] => 105
[5,2,6,3,1,4] => 100
[5,2,6,3,4,1] => 99
[5,2,6,4,1,3] => 97
[5,2,6,4,3,1] => 85
[5,3,1,2,4,6] => 76
[5,3,1,2,6,4] => 90
[5,3,1,4,2,6] => 92
[5,3,1,4,6,2] => 92
[5,3,1,6,2,4] => 100
[5,3,1,6,4,2] => 96
[5,3,2,1,4,6] => 76
[5,3,2,1,6,4] => 90
[5,3,2,4,1,6] => 90
[5,3,2,4,6,1] => 89
[5,3,2,6,1,4] => 98
[5,3,2,6,4,1] => 93
[5,3,4,1,2,6] => 92
[5,3,4,1,6,2] => 100
[5,3,4,2,1,6] => 86
[5,3,4,2,6,1] => 93
[5,3,4,6,1,2] => 100
[5,3,4,6,2,1] => 85
[5,3,6,1,2,4] => 100
[5,3,6,1,4,2] => 104
[5,3,6,2,1,4] => 94
[5,3,6,2,4,1] => 97
[5,3,6,4,1,2] => 96
[5,3,6,4,2,1] => 81
[5,4,1,2,3,6] => 76
[5,4,1,2,6,3] => 89
[5,4,1,3,2,6] => 86
[5,4,1,3,6,2] => 90
[5,4,1,6,2,3] => 99
[5,4,1,6,3,2] => 92
[5,4,2,1,3,6] => 76
[5,4,2,1,6,3] => 89
[5,4,2,3,1,6] => 84
[5,4,2,3,6,1] => 87
[5,4,2,6,1,3] => 97
[5,4,2,6,3,1] => 89
[5,4,3,1,2,6] => 74
[5,4,3,1,6,2] => 86
[5,4,3,2,1,6] => 68
[5,4,3,2,6,1] => 79
[5,4,3,6,1,2] => 94
[5,4,3,6,2,1] => 79
[5,4,6,1,2,3] => 99
[5,4,6,1,3,2] => 100
[5,4,6,2,1,3] => 93
[5,4,6,2,3,1] => 93
[5,4,6,3,1,2] => 86
[5,4,6,3,2,1] => 71
[5,6,1,2,3,4] => 90
[5,6,1,2,4,3] => 99
[5,6,1,3,2,4] => 100
[5,6,1,3,4,2] => 100
[5,6,1,4,2,3] => 101
[5,6,1,4,3,2] => 94
[5,6,2,1,3,4] => 90
[5,6,2,1,4,3] => 99
[5,6,2,3,1,4] => 98
[5,6,2,3,4,1] => 97
[5,6,2,4,1,3] => 99
[5,6,2,4,3,1] => 91
[5,6,3,1,2,4] => 88
[5,6,3,1,4,2] => 96
[5,6,3,2,1,4] => 82
[5,6,3,2,4,1] => 89
[5,6,3,4,1,2] => 96
[5,6,3,4,2,1] => 81
[5,6,4,1,2,3] => 85
[5,6,4,1,3,2] => 86
[5,6,4,2,1,3] => 79
[5,6,4,2,3,1] => 79
[5,6,4,3,1,2] => 72
[5,6,4,3,2,1] => 57
[6,1,2,3,4,5] => 68
[6,1,2,3,5,4] => 81
[6,1,2,4,3,5] => 86
[6,1,2,4,5,3] => 86
[6,1,2,5,3,4] => 91
[6,1,2,5,4,3] => 88
[6,1,3,2,4,5] => 84
[6,1,3,2,5,4] => 97
[6,1,3,4,2,5] => 92
[6,1,3,4,5,2] => 87
[6,1,3,5,2,4] => 97
[6,1,3,5,4,2] => 89
[6,1,4,2,3,5] => 90
[6,1,4,2,5,3] => 98
[6,1,4,3,2,5] => 92
[6,1,4,3,5,2] => 95
[6,1,4,5,2,3] => 98
[6,1,4,5,3,2] => 87
[6,1,5,2,3,4] => 91
[6,1,5,2,4,3] => 96
[6,1,5,3,2,4] => 93
[6,1,5,3,4,2] => 93
[6,1,5,4,2,3] => 90
[6,1,5,4,3,2] => 79
[6,2,1,3,4,5] => 74
[6,2,1,3,5,4] => 87
[6,2,1,4,3,5] => 92
[6,2,1,4,5,3] => 92
[6,2,1,5,3,4] => 97
[6,2,1,5,4,3] => 94
[6,2,3,1,4,5] => 86
[6,2,3,1,5,4] => 99
[6,2,3,4,1,5] => 92
[6,2,3,4,5,1] => 86
[6,2,3,5,1,4] => 97
[6,2,3,5,4,1] => 88
[6,2,4,1,3,5] => 92
[6,2,4,1,5,3] => 100
[6,2,4,3,1,5] => 92
[6,2,4,3,5,1] => 94
[6,2,4,5,1,3] => 98
[6,2,4,5,3,1] => 86
[6,2,5,1,3,4] => 93
[6,2,5,1,4,3] => 98
[6,2,5,3,1,4] => 93
[6,2,5,3,4,1] => 92
[6,2,5,4,1,3] => 90
[6,2,5,4,3,1] => 78
[6,3,1,2,4,5] => 76
[6,3,1,2,5,4] => 89
[6,3,1,4,2,5] => 92
[6,3,1,4,5,2] => 91
[6,3,1,5,2,4] => 97
[6,3,1,5,4,2] => 93
[6,3,2,1,4,5] => 76
[6,3,2,1,5,4] => 89
[6,3,2,4,1,5] => 90
[6,3,2,4,5,1] => 88
[6,3,2,5,1,4] => 95
[6,3,2,5,4,1] => 90
[6,3,4,1,2,5] => 92
[6,3,4,1,5,2] => 99
[6,3,4,2,1,5] => 86
[6,3,4,2,5,1] => 92
[6,3,4,5,1,2] => 97
[6,3,4,5,2,1] => 82
[6,3,5,1,2,4] => 93
[6,3,5,1,4,2] => 97
[6,3,5,2,1,4] => 87
[6,3,5,2,4,1] => 90
[6,3,5,4,1,2] => 89
[6,3,5,4,2,1] => 74
[6,4,1,2,3,5] => 76
[6,4,1,2,5,3] => 88
[6,4,1,3,2,5] => 86
[6,4,1,3,5,2] => 89
[6,4,1,5,2,3] => 96
[6,4,1,5,3,2] => 89
[6,4,2,1,3,5] => 76
[6,4,2,1,5,3] => 88
[6,4,2,3,1,5] => 84
[6,4,2,3,5,1] => 86
[6,4,2,5,1,3] => 94
[6,4,2,5,3,1] => 86
[6,4,3,1,2,5] => 74
[6,4,3,1,5,2] => 85
[6,4,3,2,1,5] => 68
[6,4,3,2,5,1] => 78
[6,4,3,5,1,2] => 91
[6,4,3,5,2,1] => 76
[6,4,5,1,2,3] => 92
[6,4,5,1,3,2] => 93
[6,4,5,2,1,3] => 86
[6,4,5,2,3,1] => 86
[6,4,5,3,1,2] => 79
[6,4,5,3,2,1] => 64
[6,5,1,2,3,4] => 75
[6,5,1,2,4,3] => 84
[6,5,1,3,2,4] => 85
[6,5,1,3,4,2] => 85
[6,5,1,4,2,3] => 86
[6,5,1,4,3,2] => 79
[6,5,2,1,3,4] => 75
[6,5,2,1,4,3] => 84
[6,5,2,3,1,4] => 83
[6,5,2,3,4,1] => 82
[6,5,2,4,1,3] => 84
[6,5,2,4,3,1] => 76
[6,5,3,1,2,4] => 73
[6,5,3,1,4,2] => 81
[6,5,3,2,1,4] => 67
[6,5,3,2,4,1] => 74
[6,5,3,4,1,2] => 81
[6,5,3,4,2,1] => 66
[6,5,4,1,2,3] => 70
[6,5,4,1,3,2] => 71
[6,5,4,2,1,3] => 64
[6,5,4,2,3,1] => 64
[6,5,4,3,1,2] => 57
[6,5,4,3,2,1] => 42
[1,2,3,4,5,6,7] => 99
[1,2,3,4,5,7,6] => 130
[1,2,3,4,6,5,7] => 145
[1,2,3,4,6,7,5] => 145
[1,2,3,4,7,5,6] => 160
[1,2,3,4,7,6,5] => 159
[1,2,3,5,4,6,7] => 151
[1,2,3,5,4,7,6] => 182
[1,2,3,5,6,4,7] => 167
[1,2,3,5,6,7,4] => 152
[1,2,3,5,7,4,6] => 182
[1,2,3,5,7,6,4] => 166
[1,2,3,6,4,5,7] => 173
[1,2,3,6,4,7,5] => 189
[1,2,3,6,5,4,7] => 187
[1,2,3,6,5,7,4] => 188
[1,2,3,6,7,4,5] => 189
[1,2,3,6,7,5,4] => 172
[1,2,3,7,4,5,6] => 180
[1,2,3,7,4,6,5] => 195
[1,2,3,7,5,4,6] => 194
[1,2,3,7,5,6,4] => 194
[1,2,3,7,6,4,5] => 193
[1,2,3,7,6,5,4] => 176
[1,2,4,3,5,6,7] => 151
[1,2,4,3,5,7,6] => 182
[1,2,4,3,6,5,7] => 197
[1,2,4,3,6,7,5] => 197
[1,2,4,3,7,5,6] => 212
[1,2,4,3,7,6,5] => 211
[1,2,4,5,3,6,7] => 175
[1,2,4,5,3,7,6] => 206
[1,2,4,5,6,3,7] => 177
[1,2,4,5,6,7,3] => 155
[1,2,4,5,7,3,6] => 192
[1,2,4,5,7,6,3] => 169
[1,2,4,6,3,5,7] => 197
[1,2,4,6,3,7,5] => 213
[1,2,4,6,5,3,7] => 197
[1,2,4,6,5,7,3] => 191
[1,2,4,6,7,3,5] => 199
[1,2,4,6,7,5,3] => 175
[1,2,4,7,3,5,6] => 204
[1,2,4,7,3,6,5] => 219
[1,2,4,7,5,3,6] => 204
[1,2,4,7,5,6,3] => 197
[1,2,4,7,6,3,5] => 203
[1,2,4,7,6,5,3] => 179
[1,2,5,3,4,6,7] => 175
[1,2,5,3,4,7,6] => 206
[1,2,5,3,6,4,7] => 207
[1,2,5,3,6,7,4] => 200
[1,2,5,3,7,4,6] => 222
[1,2,5,3,7,6,4] => 214
[1,2,5,4,3,6,7] => 195
[1,2,5,4,3,7,6] => 226
[1,2,5,4,6,3,7] => 213
[1,2,5,4,6,7,3] => 199
[1,2,5,4,7,3,6] => 228
[1,2,5,4,7,6,3] => 213
[1,2,5,6,3,4,7] => 207
[1,2,5,6,3,7,4] => 216
[1,2,5,6,4,3,7] => 205
[1,2,5,6,4,7,3] => 207
[1,2,5,6,7,3,4] => 202
[1,2,5,6,7,4,3] => 177
[1,2,5,7,3,4,6] => 214
[1,2,5,7,3,6,4] => 222
[1,2,5,7,4,3,6] => 212
[1,2,5,7,4,6,3] => 213
[1,2,5,7,6,3,4] => 206
[1,2,5,7,6,4,3] => 181
[1,2,6,3,4,5,7] => 185
[1,2,6,3,4,7,5] => 209
[1,2,6,3,5,4,7] => 215
[1,2,6,3,5,7,4] => 216
[1,2,6,3,7,4,5] => 225
[1,2,6,3,7,5,4] => 216
[1,2,6,4,3,5,7] => 205
[1,2,6,4,3,7,5] => 229
[1,2,6,4,5,3,7] => 221
[1,2,6,4,5,7,3] => 215
[1,2,6,4,7,3,5] => 231
[1,2,6,4,7,5,3] => 215
[1,2,6,5,3,4,7] => 211
[1,2,6,5,3,7,4] => 228
[1,2,6,5,4,3,7] => 209
[1,2,6,5,4,7,3] => 219
[1,2,6,5,7,3,4] => 230
[1,2,6,5,7,4,3] => 205
[1,2,6,7,3,4,5] => 217
[1,2,6,7,3,5,4] => 224
[1,2,6,7,4,3,5] => 215
[1,2,6,7,4,5,3] => 215
[1,2,6,7,5,3,4] => 206
[1,2,6,7,5,4,3] => 181
[1,2,7,3,4,5,6] => 188
[1,2,7,3,4,6,5] => 211
[1,2,7,3,5,4,6] => 218
[1,2,7,3,5,6,4] => 218
[1,2,7,3,6,4,5] => 225
[1,2,7,3,6,5,4] => 216
[1,2,7,4,3,5,6] => 208
[1,2,7,4,3,6,5] => 231
[1,2,7,4,5,3,6] => 224
[1,2,7,4,5,6,3] => 217
[1,2,7,4,6,3,5] => 231
[1,2,7,4,6,5,3] => 215
[1,2,7,5,3,4,6] => 214
[1,2,7,5,3,6,4] => 230
[1,2,7,5,4,3,6] => 212
[1,2,7,5,4,6,3] => 221
[1,2,7,5,6,3,4] => 230
[1,2,7,5,6,4,3] => 205
[1,2,7,6,3,4,5] => 213
[1,2,7,6,3,5,4] => 220
[1,2,7,6,4,3,5] => 211
[1,2,7,6,4,5,3] => 211
[1,2,7,6,5,3,4] => 202
[1,2,7,6,5,4,3] => 177
[1,3,2,4,5,6,7] => 145
[1,3,2,4,5,7,6] => 176
[1,3,2,4,6,5,7] => 191
[1,3,2,4,6,7,5] => 191
[1,3,2,4,7,5,6] => 206
[1,3,2,4,7,6,5] => 205
[1,3,2,5,4,6,7] => 197
[1,3,2,5,4,7,6] => 228
[1,3,2,5,6,4,7] => 213
[1,3,2,5,6,7,4] => 198
[1,3,2,5,7,4,6] => 228
[1,3,2,5,7,6,4] => 212
[1,3,2,6,4,5,7] => 219
[1,3,2,6,4,7,5] => 235
[1,3,2,6,5,4,7] => 233
[1,3,2,6,5,7,4] => 234
[1,3,2,6,7,4,5] => 235
[1,3,2,6,7,5,4] => 218
[1,3,2,7,4,5,6] => 226
[1,3,2,7,4,6,5] => 241
[1,3,2,7,5,4,6] => 240
[1,3,2,7,5,6,4] => 240
[1,3,2,7,6,4,5] => 239
[1,3,2,7,6,5,4] => 222
[1,3,4,2,5,6,7] => 173
[1,3,4,2,5,7,6] => 204
[1,3,4,2,6,5,7] => 219
[1,3,4,2,6,7,5] => 219
[1,3,4,2,7,5,6] => 234
[1,3,4,2,7,6,5] => 233
[1,3,4,5,2,6,7] => 185
[1,3,4,5,2,7,6] => 216
[1,3,4,5,6,2,7] => 181
[1,3,4,5,6,7,2] => 156
[1,3,4,5,7,2,6] => 196
[1,3,4,5,7,6,2] => 170
[1,3,4,6,2,5,7] => 207
[1,3,4,6,2,7,5] => 223
[1,3,4,6,5,2,7] => 201
[1,3,4,6,5,7,2] => 192
[1,3,4,6,7,2,5] => 203
[1,3,4,6,7,5,2] => 176
[1,3,4,7,2,5,6] => 214
[1,3,4,7,2,6,5] => 229
[1,3,4,7,5,2,6] => 208
[1,3,4,7,5,6,2] => 198
[1,3,4,7,6,2,5] => 207
[1,3,4,7,6,5,2] => 180
[1,3,5,2,4,6,7] => 197
[1,3,5,2,4,7,6] => 228
[1,3,5,2,6,4,7] => 229
[1,3,5,2,6,7,4] => 222
[1,3,5,2,7,4,6] => 244
[1,3,5,2,7,6,4] => 236
[1,3,5,4,2,6,7] => 205
[1,3,5,4,2,7,6] => 236
[1,3,5,4,6,2,7] => 217
[1,3,5,4,6,7,2] => 200
[1,3,5,4,7,2,6] => 232
[1,3,5,4,7,6,2] => 214
[1,3,5,6,2,4,7] => 217
[1,3,5,6,2,7,4] => 226
[1,3,5,6,4,2,7] => 209
[1,3,5,6,4,7,2] => 208
[1,3,5,6,7,2,4] => 206
[1,3,5,6,7,4,2] => 178
[1,3,5,7,2,4,6] => 224
[1,3,5,7,2,6,4] => 232
[1,3,5,7,4,2,6] => 216
[1,3,5,7,4,6,2] => 214
[1,3,5,7,6,2,4] => 210
[1,3,5,7,6,4,2] => 182
[1,3,6,2,4,5,7] => 207
[1,3,6,2,4,7,5] => 231
[1,3,6,2,5,4,7] => 237
[1,3,6,2,5,7,4] => 238
[1,3,6,2,7,4,5] => 247
[1,3,6,2,7,5,4] => 238
[1,3,6,4,2,5,7] => 215
[1,3,6,4,2,7,5] => 239
[1,3,6,4,5,2,7] => 225
[1,3,6,4,5,7,2] => 216
[1,3,6,4,7,2,5] => 235
[1,3,6,4,7,5,2] => 216
[1,3,6,5,2,4,7] => 221
[1,3,6,5,2,7,4] => 238
[1,3,6,5,4,2,7] => 213
[1,3,6,5,4,7,2] => 220
[1,3,6,5,7,2,4] => 234
[1,3,6,5,7,4,2] => 206
[1,3,6,7,2,4,5] => 227
[1,3,6,7,2,5,4] => 234
[1,3,6,7,4,2,5] => 219
[1,3,6,7,4,5,2] => 216
[1,3,6,7,5,2,4] => 210
[1,3,6,7,5,4,2] => 182
[1,3,7,2,4,5,6] => 210
[1,3,7,2,4,6,5] => 233
[1,3,7,2,5,4,6] => 240
[1,3,7,2,5,6,4] => 240
[1,3,7,2,6,4,5] => 247
[1,3,7,2,6,5,4] => 238
[1,3,7,4,2,5,6] => 218
[1,3,7,4,2,6,5] => 241
[1,3,7,4,5,2,6] => 228
[1,3,7,4,5,6,2] => 218
[1,3,7,4,6,2,5] => 235
[1,3,7,4,6,5,2] => 216
[1,3,7,5,2,4,6] => 224
[1,3,7,5,2,6,4] => 240
[1,3,7,5,4,2,6] => 216
[1,3,7,5,4,6,2] => 222
[1,3,7,5,6,2,4] => 234
[1,3,7,5,6,4,2] => 206
[1,3,7,6,2,4,5] => 223
[1,3,7,6,2,5,4] => 230
[1,3,7,6,4,2,5] => 215
[1,3,7,6,4,5,2] => 212
[1,3,7,6,5,2,4] => 206
[1,3,7,6,5,4,2] => 178
[1,4,2,3,5,6,7] => 167
[1,4,2,3,5,7,6] => 198
[1,4,2,3,6,5,7] => 213
[1,4,2,3,6,7,5] => 213
[1,4,2,3,7,5,6] => 228
[1,4,2,3,7,6,5] => 227
[1,4,2,5,3,6,7] => 207
[1,4,2,5,3,7,6] => 238
[1,4,2,5,6,3,7] => 217
[1,4,2,5,6,7,3] => 199
[1,4,2,5,7,3,6] => 232
[1,4,2,5,7,6,3] => 213
[1,4,2,6,3,5,7] => 229
[1,4,2,6,3,7,5] => 245
[1,4,2,6,5,3,7] => 237
[1,4,2,6,5,7,3] => 235
[1,4,2,6,7,3,5] => 239
[1,4,2,6,7,5,3] => 219
[1,4,2,7,3,5,6] => 236
[1,4,2,7,3,6,5] => 251
[1,4,2,7,5,3,6] => 244
[1,4,2,7,5,6,3] => 241
[1,4,2,7,6,3,5] => 243
[1,4,2,7,6,5,3] => 223
[1,4,3,2,5,6,7] => 187
[1,4,3,2,5,7,6] => 218
[1,4,3,2,6,5,7] => 233
[1,4,3,2,6,7,5] => 233
[1,4,3,2,7,5,6] => 248
[1,4,3,2,7,6,5] => 247
[1,4,3,5,2,6,7] => 215
[1,4,3,5,2,7,6] => 246
[1,4,3,5,6,2,7] => 219
[1,4,3,5,6,7,2] => 198
[1,4,3,5,7,2,6] => 234
[1,4,3,5,7,6,2] => 212
[1,4,3,6,2,5,7] => 237
[1,4,3,6,2,7,5] => 253
[1,4,3,6,5,2,7] => 239
[1,4,3,6,5,7,2] => 234
[1,4,3,6,7,2,5] => 241
[1,4,3,6,7,5,2] => 218
[1,4,3,7,2,5,6] => 244
[1,4,3,7,2,6,5] => 259
[1,4,3,7,5,2,6] => 246
[1,4,3,7,5,6,2] => 240
[1,4,3,7,6,2,5] => 245
[1,4,3,7,6,5,2] => 222
[1,4,5,2,3,6,7] => 207
[1,4,5,2,3,7,6] => 238
[1,4,5,2,6,3,7] => 233
[1,4,5,2,6,7,3] => 223
[1,4,5,2,7,3,6] => 248
[1,4,5,2,7,6,3] => 237
[1,4,5,3,2,6,7] => 211
[1,4,5,3,2,7,6] => 242
[1,4,5,3,6,2,7] => 231
[1,4,5,3,6,7,2] => 218
[1,4,5,3,7,2,6] => 246
[1,4,5,3,7,6,2] => 232
[1,4,5,6,2,3,7] => 221
[1,4,5,6,2,7,3] => 227
[1,4,5,6,3,2,7] => 211
[1,4,5,6,3,7,2] => 214
[1,4,5,6,7,2,3] => 207
[1,4,5,6,7,3,2] => 178
[1,4,5,7,2,3,6] => 228
[1,4,5,7,2,6,3] => 233
[1,4,5,7,3,2,6] => 218
[1,4,5,7,3,6,2] => 220
[1,4,5,7,6,2,3] => 211
[1,4,5,7,6,3,2] => 182
[1,4,6,2,3,5,7] => 217
[1,4,6,2,3,7,5] => 241
[1,4,6,2,5,3,7] => 241
[1,4,6,2,5,7,3] => 239
[1,4,6,2,7,3,5] => 251
[1,4,6,2,7,5,3] => 239
[1,4,6,3,2,5,7] => 221
[1,4,6,3,2,7,5] => 245
[1,4,6,3,5,2,7] => 239
[1,4,6,3,5,7,2] => 234
[1,4,6,3,7,2,5] => 249
[1,4,6,3,7,5,2] => 234
[1,4,6,5,2,3,7] => 225
[1,4,6,5,2,7,3] => 239
[1,4,6,5,3,2,7] => 215
[1,4,6,5,3,7,2] => 226
click to show generating function       
Description
The sum of St000483 over all subsequences of length at least three.
References
[1] Ahmed, T., Snevily, H. Some properties of roller coaster permutations MathSciNet:3136863
Code
# code could be simplified...

def inc_runs(w):
    """
    runs in w of length at least 2

    sage: sage: pi = Permutation([2,1,4,3])
    sage: inc_runs(pi)
    """
    runs = []
    current_value = w[0]
    current_run = [w[0]]
    for i in w[1:]:
        if i < current_value:
            if len(current_run) > 1:
                runs.append(current_run)
            current_run = [i]
        else:
            current_run.append(i)

        current_value = i
    if len(current_run) > 1:        
        runs.append(current_run)

    return len(runs)

def dec_runs(w):
    """
    sage: pi = Permutation([2,1,4,3])
    sage: dec_runs(pi)
    """
    return inc_runs(w[::-1])

def total_runs(w):
    """
    sage: all(total_runs(pi)==1+pi.number_of_peaks()+pi.complement().number_of_peaks() for pi in Permutations(6))
    True
    """
    return inc_runs(w) + dec_runs(w)

def statistic(pi):
    """
    sage: statistic([2,1,4,3])
    11

    sage: statistic([1,2,3,4])
    5
    """
    return sum([total_runs(tau) for k in range(3, len(pi)+1) for tau in Subwords(pi, k)])

Created
May 10, 2016 at 15:02 by Martin Rubey
Updated
May 10, 2019 at 17:38 by Henning Ulfarsson