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