// Your code here!

import std.stdio;
import std.range;
import std.array;
import std.algorithm;
import std.conv;
import std.string;

void main(){
  auto ab = readln().chomp().split().map!(to!long);
  auto a = ab[0];
  auto b = ab[1];
  solve(a, b).writeln();
}

long solve(long a, long b){
    auto eastIdx = b - a;
    long westLength = iota(1, eastIdx).sum;
    return westLength - a;
}