#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, u, v, c, r, a, b;
  cin >> a >> b;
  if (b < a) swap(a, b);
  n = (a + b) / 2;
  u = n - a;
  v = b - n;
  cout << v * (v + 1) / 2 + u * (u + 1) / 2;
}
