Solve problem 65 using Haskell.