import math

N = int(input())
ans = N
root = int(math.sqrt(N))

for i in range(1, root + 10):
    if N % i == 0:
        b = N // i
        if i >= 3:
            ans = min(ans, i)
        if b >= 3:
            ans = min(ans, b)

print(ans)