Solves problem 11 in haskell