# -*- coding: utf-8 -*- N = input() i = 3 found = False ans = 1e9 while i * i <= N: if N % i == 0: found = True ans = min(ans, i) break i += 1 if found == False and N % 2 == 0 and N != 4: i = N / 2 found = True print i if found else N