n=int(eval(input()))

max=0

if(n==1):

  print((1))

else:

  for i in range(n):

    for j in range(2,10):

      if(max<=i**j and i**j<=n):

        max=i**j

  print(max)
import math

n = int(eval(input()))

j = 2

tmp = 0

Max = 1

for i in range(2,n):

  while(n > tmp):

    tmp = i**j

    j+=1

    if(Max < tmp and n >= tmp):

      Max = tmp

  j = 2

  tmp = 0

print(Max)
n = int(eval(input()))
max = 0
if n == 1:
    print((1))
else:
    for i in range(n):
        for j in range(2, 10):
            if max <= i**j and i**j <= n:
                max = i**j
    print(max)

import math

n = int(eval(input()))
j = 2
tmp = 0
Max = 1
for i in range(2, n):
    while n > tmp:
        tmp = i**j
        j += 1
        if Max < tmp and n >= tmp:
            Max = tmp
    j = 2
    tmp = 0
print(Max)

+import math + -max = 0 -if n == 1: -    print((1)) -else: -    for i in range(n): -        for j in range(2, 10): -            if max <= i**j and i**j <= n: -                max = i**j -    print(max) +j = 2 +tmp = 0 +Max = 1 +for i in range(2, n): +    while n > tmp: +        tmp = i**j +        j += 1 +        if Max < tmp and n >= tmp: +            Max = tmp +    j = 2 +    tmp = 0 +print(Max)