N = int(input()) if N%3 == 0: print(0) else: print(3-N%3)