Next permutation for a list of integers