import scala.io.StdIn

object Main extends App {

  // 1 2 3 4  5  6
  // 1 3 6 10 15 21
  val a = StdIn.readLine().split(" ").map(_.toInt)
  val index = a(1) - a(0)
  val r = (1 to index).sum
  println(r - a(1))
}
