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