import math def cnv(N): for n in range(3, int(math.sqrt(N)) + 1): if N % n == 0: return n if N % 2 == 0: return N // 2 else: return N def main(): N = int(input()) print(cnv(N)) if __name__ == '__main__': main()