Problem 12 (Haskell)