#include <bits/stdc++.h>
using namespace std;
int main() {
  int num1, num2;
  int m, sum = 0, i, x;
  cin >> num1 >> num2;
  x = num2 - num1;
  if (x < 0) x = -x;
  m = (x) / 2;
  for (i = 0; i < m; i++) {
    sum = sum + i + 1;
  }
  sum = 2 * sum;
  if ((x) % 2 == 1) {
    sum = sum + i + 1;
  }
  cout << sum;
  return 0;
}
