#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, sum = 0;
  cin >> a >> b;
  int mid = (a + b) / 2;
  a = abs(mid - a);
  b = abs(mid - b);
  cout << (a * (a + 1)) / 2 + (b * (b + 1)) / 2 << endl;
  return 0;
}
