M = int(input()) m = 1 for i in range(128): m *= 2 if m >= M: m %= M print(m)