n = int(input()) r = n%3 ans = 0 if r == 2: ans = 1 if r == 1: ans = 2 print(ans)