{-
  Copyright (C) 2008 Dmitry Negoda, http://ndv.mywebcommunity.org
  
  This file is part of Book of Programming Problems (http://ndv.mywebcommunity.org/problems).
  It is free software; you can redistribute it and/or modify
  it with no limits.	This software is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of	MERCHANTABILITY or 
  FITNESS FOR A PARTICULAR PURPOSE.
-}
module Solution where

import Data.Bits;

grey :: Int -> Int
grey x = x `xor` (shiftR x 1)