#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x, y;
  long long ans1 = 0, ans2 = 0, ans = 0;
  int flag = 0;
  cin >> a >> b;
  x = min(a, b);
  y = max(a, b);
  while (x != y) {
    if (flag) {
      x++;
      ans1++;
      ans += ans1;
      flag = 0;
    } else {
      y--;
      ans2++;
      ans += ans2;
      flag = 1;
    }
  }
  cout << ans << endl;
  return 0;
}
