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