#include <bits/stdc++.h>
using namespace std;
int main() {
  int long long t, n, a, b, c, d, k, m = 0, as = 0, odd = 0, ev = 0;
  cin >> a >> b;
  if (b < a) swap(a, b);
  if ((a - b) % 2) {
    k = (a + b) / 2 - a;
    cout << k * (k + 1) + k + 1;
  } else {
    k = (a + b) / 2 - a;
    cout << k * (k + 1);
  }
}
