import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  [a, b] <- map (read::String -> Int) .  words <$> getLine
  let n = b - a - 1
  print $ sum [1..n] - a
