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