import java.util.*;
public class pro931A{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = 0; 
    if(Math.abs(a-b) == 1){System.out.print(1);}
    else{
      for(int i=2;i<Math.abs(a-b);i++){
        c += i;
      }
      System.out.println(c);
    }
  }
}
