permutations with restriction

visit shbcf.ru