def calc(n): # 0123 if n % 3 == 0: return 0 elif n % 3 == 1: return 2 elif n % 3 == 2: return 1 print(calc(int(input())))