from math import sqrt def divisor(N): ret = [] for i in range(1,int(sqrt(N))+1): if N % i == 0: ret.append(i) if N // i != i: ret.append(N//i) ret.sort() return ret N = int(input()) D = divisor(N) for d in D: if d <= 2: continue print(d) break