N = int(input()) def func(n): c = int(n**0.5) + 1 for i in range(3, c): if n % i == 0: return i return (n//2 if n % 2 == 0 else n) print(func(N))