fun main(args: Array<String>) {
  val n = readLine()!!.toLong()
  var q = 1L
  var sum = 0L
  while (q * q <= n) {
    if (n % q != 0L) {
      q++
      continue
    }
    val m = n / q - 1L
    if (q < m) {
      sum += m
    }
    q++
  }
  println(sum)
}