#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, i, j, sum, sum2, A, B, x;
  cin >> a >> b;
  if ((a + b) % 2 == 0)
    x = (a + b) / 2;
  else
    x = ((a + b) / 2) + 1;
  A = abs(x - a);
  B = abs(x - b);
  sum = 0;
  for (i = 1; i <= A; i++) sum = sum + i;
  sum2 = 0;
  for (j = 1; j <= B; j++) sum2 = sum2 + j;
  cout << sum + sum2 << endl;
  return 0;
}
