print("021"[int(input())%3])