N = int(input()) # 素数列挙 def prime(x): prime = [x if x%2==1 else 2 for x in range(x+1)] prime[0] = 1 for i in range(3, int(x**0.5)+2, 2): if prime[i] != i: continue for j in range(2*i, x+1, i): if prime[j] == j: prime[j] = i p = {i for i in range(2, x+1) if prime[i] == i} return p p = prime(int(N**0.5)+10) p = sorted(p) for v in p: if v != 2 and N % v == 0: ans = v break else: if N % 2 == 0: ans = N // 2 else: ans = N print(ans)