a permutation p length n sequence distinct integer p1p2pn 1pin a permutation identity permutation follow equation hold pii a swap ij operation swap element pi pj permutation Lets assume fp minimum number swap need permutation p identity permutation Valera wonder transform permutation p permutation q fqm minimum number swap help