def main(): n = int(input()) d = 3 while d * d <= n: if n % d == 0: print(d) break d += 1 else: if n % 2 == 0 and n // 2 != 2: print(n//2) else: print(n) if __name__ == '__main__': main()