counting lexicographic permutations