fun main(args: Array<String>) {
    val elements  = readLine()!!.split(" ").map { it.toInt() }
    val a = elements.get(0)
    val b = elements.get(1)
    val num = b - a
    val result = (num + 1)*num/2 - b
    println(result)
}