Counting permutations or combinations