main = interact $ unlines . map (show . coconut_grab . read) . init . lines
 
coconut_grab e = minimum cands
 where
  cands = [x+y+z | let z' = (floor.cbrt.fromIntegral) e, z<-[0..z'],
                   let y' = (floor.sqrt.fromIntegral) (e-z^3), y<-[0..y'],
                   let x = e-z^3-y^2]

cbrt q = until approx (\q' -> q' - (q'^3-q) / (3*q'^2)) (q/2)
 where approx x = abs (x^3 - q) < 0.00001*q