module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  x <- readLn :: IO Int
  print $ f x
  where
    f x | x == 1 = 1
        | otherwise = maximum [g x n (n * n) | n <- [2 .. x]]
    g x a aa | aa > x = 0
             | (aa * a) > x = aa
             | otherwise = g x a (aa * a)
