how to solve permutation

join shbcf.ru