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