import scala.annotation.tailrec
import scala.io.StdIn

object Main extends App {

  def f(a:Long, b:Long):Long = {
    @tailrec
    def rec(acc:Long, num:Long):Long = {
      if(num == 0L) acc
      else rec(acc+1L, num/10L)
    }
    math.max(rec(0L,a), rec(0L,b))
  }

  val n =StdIn.readLong
  val r = math.sqrt(n).toLong
  val ans = (2L to r)./:(f(n, 1))((acc,i) => {
    if(n % i == 0) math.min(acc, f(n/i, i))
    else acc
  })
  println(ans)
}