Solution for problem 58.