#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, ans, res1, res2, l, r, mid;
  cin >> a >> b;
  mid = (a + b) / 2;
  l = abs(mid - a);
  r = abs(mid - b);
  res1 = (l * (l + 1)) / 2;
  res2 = (r * (r + 1)) / 2;
  cout << res1 + res2 << endl;
  return 0;
}
