#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, calc = 0;
  cin >> a >> b;
  int avarge = (a + b) / 2;
  for (int i = 1; i < avarge; ++i) {
    if (a > b) {
      if (b == avarge) {
        a -= 1;
        calc += i;
      } else {
        a -= 1;
        b += 1;
        calc += (i * 2);
      }
    } else if (b > a) {
      if (a == avarge) {
        b -= 1;
        calc += i;
      } else {
        a += 1;
        b -= 1;
        calc += (i * 2);
      }
    } else if (a == b)
      break;
  }
  cout << calc;
  return 0;
}
