Solves problem 22