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