#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a > b) {
    int aux = a;
    a = b;
    b = aux;
  }
  long long ra = 0;
  long long rb = 0;
  long long cont = 1;
  while (b - a > 1) {
    b--;
    a++;
    ra += cont;
    rb += cont;
    cont++;
  }
  if (b - a == 1) ra += cont;
  printf("%lld\n", ra + rb);
  return 0;
}
