N=int(input()) if N%3==0: print(0) elif N%3==2: print(1) else: print(2)