Solves problem 23