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