import Foundation
let heights = readLine()!.componentsSeparatedByString(" ").map{Int($0)!}
var preciseHeight = 0
for i in 1...(heights[1] - heights[0]) {
  preciseHeight += i
}
print(preciseHeight - heights[1])