def main(): N = int(input()) for i in range(3, N // 2): if not N % i: break else: i = N print(i) main()