Solution for problem 58. all to easy.