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