import math N = int(input()) ans = 1 root = int(math.sqrt(N)) for i in range(3, root + 1, 2): if i % 2 == 1 and N % i == 0: ans = i break print(ans)