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