import sys def input(): return sys.stdin.readline().rstrip('\n') def main(): n = int(input()) i = 3 while i*i <= n: if n % i == 0: print(i) return i += 1 if n % 2 == 0 and n > 4: print(n//2) else: print(n) if __name__ == '__main__': main()