ls = int(input()) t = ls % 3 if t == 2: print(1) elif t == 1: print(2) else: print(0)