import math N = long(raw_input()) flag = False for i in range(3,int(math.sqrt(N)) + 1): if N % i == 0: flag = True print i break if not flag and N % 2 == 0: print N / 2 elif not flag: print N