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