Solving problem 17