n = int(input()) if n <=4: print(8 - n) else: print(n)