import Control.Applicative
import Control.Monad
main = do
    ss <- string2int <$> getLine
    putStrLn $ show ( ans ss )

ans::Int -> Int
ans x
  | x == 0 = 1
  | x == 1 = 2
  | x == 2 = 1
  | otherwise = 0
string2int str = read str :: Int -- string2int ??? string to int ?????\