#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, ans = 0;
  cin >> a;
  cin >> b;
  long long int x = (a + b) / 2;
  long long int n1, n2;
  if (a < b) {
    n1 = x - a;
    ans += (n1 * (n1 + 1)) / 2;
    n2 = b - x;
    ans += (n2 * (n2 + 1)) / 2;
  } else if (a > b) {
    n1 = x - b;
    ans += (n1 * (n1 + 1)) / 2;
    n2 = a - x;
    ans += (n2 * (n2 + 1)) / 2;
  }
  cout << ans << endl;
}
