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