Exercise 3 from DFI 1