#include <bits/stdc++.h>
int main() {
  int a, b, tiredness = 0, i = 1;
  scanf("%d", &a);
  scanf("%d", &b);
  if (a < b)
    while (a != b) {
      a++;
      tiredness += i;
      if (a == b) break;
      b--;
      tiredness += i;
      i++;
    }
  else
    while (a != b) {
      b++;
      tiredness += i;
      if (a == b) break;
      a--;
      tiredness += i;
      i++;
    }
  printf("%d\n", tiredness);
  return 0;
}
