N=int(input()) #N,M=map(int,input().split()) #A=list(map(int, input().split())) if N%3==0: print(0) elif N%3==1: print(2) else: print(1)