object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN) = readLine.split(" ").map(_.toLong)

    def makeDivisor(n: Long): Vector[Long] = {
      //for(i <- 1 to (math.sqrt(n).toInt + 1) if(i % 2 == 0)) yield i
      ((1 to (math.sqrt(n).toInt)).filter(i => n % i == 0)).map(_.toLong).toVector
    }
    val divN = makeDivisor(datN)

    def countDigit(a: Long): Int = {
      a.toString.split("").filterNot(_ == "").length
    }
    val ans = divN.foldLeft(100000)((acc, dat) =>
      math.min(acc, math.max(countDigit(dat), countDigit(datN / dat)))
    )

    println(ans)
  }
}
