program diverta2019_d
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: n,i,ans=0

    read*, n
    i=1
    do while(i*i <= n)
        if (mod(n,i) == 0) then
            if (i*(i+1) < n) ans=ans+(n/i-1)
        end if
        i=i+1
    end do
    print'(i0)', ans
end program diverta2019_d