Solution for Problem 11. Starting to solve Problem 12