import java.util.*
import java.math.*

fun main(args: Array<String>) {

//    var (N, K) = readLine()!!.split(" ").map { it.toInt() }
    var N = readLine()!!.toLong()
//    val S = readLine()!!
//    val D = readLine()!!.split(" ").map { it.toLong() }
//    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    var ans = 0L
    var n = Math.sqrt(N.toDouble()).toLong()

    for (m in 1..n) {
        if (N%m != 0L) continue
        val d = N/m

        if (m!=1L && N/(m-1) == N%(m-1)) ans += m-1
        if (d!=1L && N/(d-1) == N%(d-1)) ans += d-1
    }

    println(ans)
}