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