Solve #49 in Haskell.