#include <bits/stdc++.h>
int main() {
  int n, h, c, p = 0, j;
  scanf("%d\n%d", &n, &h);
  if (n > h)
    c = n - h;
  else
    c = h - n;
  if (c == 1)
    p = 1;
  else if (c % 2 == 0) {
    for (int i = 1; i <= c / 2; i++) {
      p += 2 * i;
    }
  } else {
    for (j = 1; j <= (c - 1) / 2; j++) {
      p = p + 2 * j;
    }
    p = p + j + 1;
  }
  printf("%d\n", p);
  return 0;
}
