Solve exercise 3 from set 1