let digit = string >> Seq.length >> int64
let max64 (a: int64) (b: int64) = if a <= b then b else a
let min64 (a: int64) (b: int64) = if a <= b then a else b

let rec maxDivisorDigit n a acc =
    if n <= a * a then acc
    elif n % a = 0L then maxDivisorDigit n (a + 1L) (max64 (digit a) (digit (n / a)))
    else maxDivisorDigit n (a + 1L) acc

[<EntryPoint>]
let main argv =
    let n = stdin.ReadLine() |> int64
    maxDivisorDigit n 1L 0L |> printfn "%i"
    0