program exp
	implicit none
	integer :: y, c, i
	real(8) :: x

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

end program exp