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