def minrep(N): i = 3 while(i*i<=N): if N % i == 0: return i i += 1 if N % 2 == 0 and N / 2 > 2: return N/2 return N N = int(raw_input()) print minrep(N)