Problem 53 in Haskell