fun main(args:Array<String>) {
    val n = readLine()!!.toLong()
    println(getAns(n))
}

fun getAns(n:Long):Long {
    var ans = 0L
    for(i in (1..n)) {
        if(i*i > n) {
            break
        }
        val b = (n-i)/i
        if(b == 0L) {
            continue
        }
        if(n%b == i) {
            ans += b
        }
    }
    return ans
}