n = io.read("*n") if n % 3 == 2 then print(1) elseif n % 3 == 1 then print(2) else print(0) end