S = int(input()) if S <= 2 ** 32: print(S) else: S = 2 ** 32 - S[1:] print(S)