#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int ans = 0;
  int k = (a + b) / 2;
  if (a > b) {
    swap(a, b);
  }
  int step = 1;
  while (a < k) {
    a++;
    ans += step;
    step++;
  }
  step = 1;
  while (b > k) {
    b--;
    ans += step;
    step++;
  }
  cout << ans;
  return 0;
}
