(defn get-keta [x ans]
  (if (< x 1)
    ans
    (get-keta (/ x 10) (+ ans 1))
      )
  )

(defn sqrt [suu shita ue]
  ;; ギリギリ越えない整数値を返す
;  (println suu shita ue)
  (let [tansaku (bigdec (/ (+ shita ue) 2))]
    (if (<= (- ue shita) 1)
      shita
      (if (<= (* tansaku tansaku) suu)
        (sqrt suu tansaku ue)
        (sqrt suu shita tansaku)
        )
      )
    )
  )

(defn dai-dvior [n i gen ans]
  (if (> i gen)
    ans
    (dai-dvior n (+ i 1) gen
                    (if (integer? (/ n i))
                      i
                      ans
                      ))
    )
  )



(defn get-ans [n p]
  (let [the-other (/ n p)]
    (get-keta the-other 0)
    )
  )

(let*
    [n (read) limit (+ (sqrt n 0 n) 1)]
  (println  (get-ans n (apply max  (map (fn [x] (if (integer? (/ n x)) x 0))
                                        (seq (range 1 limit) ))
                                   )))
  )
