Solved problem 23 on PE