#include <bits/stdc++.h>
int main() {
  int a, b, d;
  scanf("%d %d", &a, &b);
  d = a - b;
  if (d < 0) d = -d;
  if (d % 2)
    a = d / 2, b = d / 2 + 1;
  else
    a = b = d / 2;
  printf("%d", a * (a + 1) / 2 + b * (b + 1) / 2);
  return 0;
}
