Solves problem 21