#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int a1 = a;
  int b1 = b;
  int br = abs(b - a);
  br /= 2;
  int br1 = abs(b - a) % 2;
  int sol = 0;
  if (a1 == b1) {
    cout << 0;
    return 0;
  }
  for (int i = 1; i <= br; i++) {
    if (a1 > b1) {
      a--;
      b++;
    } else {
      a++;
      b--;
    }
    sol += 2 * i;
  }
  if (br1 == 1) sol += br + 1;
  cout << sol;
  return 0;
}
