Solve problem 19 using Haskell.