#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k;
  string x, y;
  cin >> n >> m;
  int dif = abs(n - m);
  k = dif / 2;
  dif = dif - k;
  cout << (((k * (k + 1)) / 2) + (dif * (dif + 1) / 2)) << endl;
  return 0;
}
