Inverts permutations