#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (b < a) {
    int temp = a;
    a = b;
    b = temp;
  }
  int ans = 0;
  int ctr1 = 1;
  int ctr2 = 1;
  while (b != a) {
    if (ctr1 <= ctr2) {
      a++;
      ans += ctr1;
      ctr1++;
    } else {
      b--;
      ans += ctr2;
      ctr2++;
    }
  }
  cout << ans;
}
