How Many Ways?

Limits: 1s, 256 MB

Regular problem solvers starts their journey by solving ad hoc and number theory. After getting the hang of it, they jump into graph and combinatorics type of problems. You are one of guys going through this phase. After learning the basics of graph theory, algorithms (bfs, dfs) and data structures (queue, stack) which are needed for understanding those, you wanted to have a break from graph theory. And thus, you started solving problems from basic combinatorics category.

This is a companion discussion topic for the original entry at