Problem 28 solution