Solution for problem 54.