Gennady and Artem are discussing solutions of different problems.
Gennady told Artem about a number theory problem he solved the day before.
One of steps to solve the problem was to calculate the least common multiple (LCM) of all integers from 1 to n, inclusive.
That problem inspired Gennady to come up with another problem about LCM's.

Given n, find the greatest m that m ≤ n and:
$LCM(1, 2, \ldots, n) = LCM(m, m + 1, \ldots, n)$

We have no doubt Artem will solve the problem, but will you?

You can find the definition of LCM here.

Input format
The only line of the input contains one integer n.

Output format
Print the greatest integer m satisfying the given conditions.

Constraints

1 ≤ n ≤ 10^{15}

SAMPLE INPUT
5

SAMPLE OUTPUT
3

Explanation

LCM(1, 2, 3, 4, 5) = 60
LCM(2, 3, 4, 5) = 60
LCM(3, 4, 5) = 60
LCM(4, 5) = 20

m = 3 is the greatest integer for which LCM(m, m+1, \ldots, 5) = LCM(1, 2, 3, 4, 5) = 60.
from sys import stdin
import math
import random
def mod(a,b,c):
		if b==0:
			return 1
		if b<=10:
			return (a**b)%c
		if b%2==1:
			return (a*mod(a,b-1,c))%c
		x=mod(a,b/2,c)
		return (x*x)%c
		
def check(p):
	if p<=1:
		return 0
	if p==2:
		return 1;
	if p%2==0:
		return 0
	count = 5
	s=p-1
	while s%2==0:
		s=s/2;
	for i in range(0,count):
		a=random.randint(1,p-1)
		temp = s
		x=mod(a,temp,p) 
		while(temp!=p-1 and x!=1 and x!=p-1):
        		x=(x*x)%p
           	 	temp *= 2;
		if(x!=p-1 and temp%2==0):
			return 0
	return 1
n = int(stdin.readline())
def solve(n,p):
	m = int(pow(n/2,1.0/p)-5)
	#print "pth root is ",pow(n/2,1.0/p)
	#print " check upto ",m,p
	if m<2:
		m = 2
	if (m**p) > n:
		return n+5
	#return m
	while True:
		if check(m):
			co = 0
			cur = n
			co = cur/(m**p)
			if co<=1:
				break
		m+=1
	if co==0:
		return n+5
	return m**p
if n==1:
	print n
else:
	ans = n
	for i in xrange(1,65):
		m = solve(n,i)
	
		if m < ans:
			ans = m
	print ans