read x
m=1
for b in `seq 2 32`
do
    if((b*b>x))
    then
        break
    fi
    p=$b
    while((p<=x))
    do
        p=$((p*b))
    done
    if((p/b>m))
    then
        m=$((p/b))
    fi
done
echo $m