import sys N = int(input()) i = 3 while i*i <= N: if N % i == 0: print(i) sys.exit() i = i+1 if N % 2 == 0 and N != 4: print(int(N/2)) else: print(N)