program exp
	implicit none
	integer :: y, c, i
	integer :: x

	read(*,*) x


	if (abs(x-1.0_8)<1.0d-10) then
		write(*,'(i0)') 1
		stop
	end if 

    c = 1
	do i = 1, int(sqrt(real(x,8))) + 1
		do y = 2, int(log(real(x,8))/log(2.0_8))+1
			if (i**y <= x) then
				c = i ** y
			else
				exit
			end if
		end do
	end do
	
	write(*,'(i0)') c
	stop
end program exp