Solved problem 52 on PE