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