N = int(input()) def divisors(N): res = [] for i in range(1, int(N ** 0.5) + 1): if N % i == 0: res.append(i) if i * i != N: res.append(N // i) res.sort() return res div = divisors(N) for d in div: if d > 2: print(d) exit()