open Scanf
open Printf

let id a = a
let pair a b = a, b
let triplet a b c = a, b, c

let rec scan_list = function
  | 1 -> scanf "%d" (fun k -> [k])
  | n -> scanf "%d " (fun k -> k :: scan_list (n-1))

let () = let a,b = scanf "%d %d\n" pair in
  let n = b - a - 1 in
  printf "%d\n" (n*(n+1)/2 - a)