<s>[INST] Find number of inversions in the permutation $X$. Given $A$, $B$, $C$ and $AXB = C$. $$
A = \begin{pmatrix}1 & 2 & 3 & 4 & 5 & 6 & 7 \\
2 & 3 & 1 & 5 & 7 & 6 & 4
\end{pmatrix} \\
B = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\
7 & 6 & 5 & 4 & 3 & 2 & 1
\end{pmatrix} \\
C = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\
4 & 5 & 7 & 6 & 2 & 3 & 1
\end{pmatrix}
$$
Permutations are applied from right to left, that is $AB$ means that the $B$ is applied first.
I know how to find number of inversions but don't know how to deal with such equations made of permutations.
 [/INST] Note
$$X=A^{-1}(AXB)B^{-1}=A^{-1}CB^{-1}$$
Computing the number of inversions of the right hand side can be done by multiplying the three permutations and computing the number of inversions of the result.
</s>