Combinatorics (for problem #4)