#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int step1 = 0, step2 = 0;
  int ans = 0;
  if (a > b) {
    int s = a + b;
    a = s - a;
    b = s - a;
  }
  int mid = (int)((a * 1.0 + b) / 2 + 0.5);
  int c1 = mid - a;
  int c2 = b - mid;
  ans = ans + (1 + c1) * c1 / 2 + (1 + c2) * c2 / 2;
  cout << ans;
  return 0;
}
