Solve 23 (now in python instead of haskell).