def run(N):
 if N%3 == 0:
  return 3
 if N%4 == 0:
  return 4
 while N%2 == 0:
   N = N // 2
 while N%3 == 0:
   N = N // 3
 p = 5
 while p * p <= N:
  if N%p == 0:
   return p
  p = p + 1
 return N

N = int(input())
print(run(N))