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