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