#include <bits/stdc++.h>
int main() {
  int temp, tired = 0, flag = 1, a, b;
  scanf("%d %d", &a, &b);
  if (a > b)
    temp = a - b;
  else
    temp = b - a;
  if (temp % 2 == 0) {
    temp /= 2;
    flag = 0;
  } else
    temp /= 2;
  for (int q = 1; q <= temp; q++) {
    tired += q;
    tired += q;
  }
  if (flag == 1)
    printf("%d\n", tired + temp + 1);
  else
    printf("%d\n", tired);
}
