Solution to problem 16