Solve problem 67 in haskell - same as 18