I came across the question where one has to count the number of permutations of a digit of a number that are less than that nuber:
ex: n = 231
perutations => 123, 132, 231, 213, 312, 321
so, the number of permutations less than 231 = [123, 132, 213] = 3 <= return