import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)

    val a = sc.nextInt()
    val b = sc.nextInt()

    val sub = b - a: Int
    var sum = 0

    for (i <- 1 to sub) {
      sum += i
    }

    println(sum - b)
  }
}