n = int(input()) for i in range(3,n+1): if i*i > n: if n%2==0 and n!=4: print(n//2) else: print(n) break if n%i==0: print(i) break