#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, i, coun = 1, sum = 0;
  cin >> a >> b;
  int dif = abs(a - b);
  int mid = dif / 2;
  if (dif % 2 == 0) {
    coun = 0;
  }
  for (i = 1; i <= mid; i++) {
    sum += i;
  }
  sum = (sum * 2) + (coun * i);
  printf("%d\n", sum);
}
