import sys x=int(input()) for i in range(3,1000010): if x%i==0: print(i) sys.exit(0) if x%2==0: print(x//2) else: print(x)