Solution for problem 23.