{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BC
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [a, b] <- map readInt . BC.words <$> BC.getLine
  print $ solve a b

solve :: Int -> Int -> Int
solve a b = h - a where
  h = ts !! (b - a - 2)
  ts = scanl1 (+) [1 .. 999]

readInt :: BC.ByteString -> Int
readInt = fst . fromJust . BC.readInt
