Solving problem 3.