fun main(args: Array<String>) {
    abc099b()
}

fun abc099b() {
    val (a, b) = readLine()!!.split(" ").map { it.toInt() }

    val diff = b - a

    // X番目の塔の高さは X*(X+1)/2、高さbの塔はb-a番目なので、b=(b-a)*(b-a+1)/2
    val bHeight = diff * (diff + 1) / 2

    val answer = bHeight - b

    println(answer)
}
