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