private fun readInts() = readLine()!!.split(" ").map { it.toInt() }

fun main(args: Array<String>) {
    val (a, b) = readInts()

    val L = (1..999).map { (it * (1 + it)) / 2 }.toList()
    println((1..499500).first { depth ->
        val indexOfA = L.indexOf(a + depth)
        val indexOfB = L.indexOf(b + depth)

        return@first indexOfA != -1 && indexOfB == indexOfA + 1
    })
}