Fifty-four in total — nine levels in each of the six episodes, and 9 × 6 gets you there.
To advance you need both keys, one gold and one silver, each hidden in a separate room. They can be tucked anywhere, so the reliable method is to search every room rather than heading straight for the exit.
Grab the treasure while you are at it, and pay attention to the walls: every level contains secret areas, and pushing along suspicious sections is how you find them. Those secrets often hold the supplies that make the later episodes survivable.