#include <bits/stdc++.h>
using namespace std;
int main() {
  int a1, b1;
  cin >> a1 >> b1;
  int a = min(a1, b1), b = max(a1, b1);
  int minv = 2 * 1000000000, cur = 0;
  for (int c = a; c < b + 1; c++) {
    cur = (c - a) * (c - a + 1) / 2 + (b - c) * (b - c + 1) / 2;
    if (minv > cur) minv = cur;
  }
  cout << minv;
}
