import Control.Applicative main :: IO () main = solve <$> readLn >>= print solve :: Int -> Int solve n = case (n `mod` 3) of 0 -> 0 1 -> 2 _ -> 1