#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int a, b, sum = 0, i = 1, j = 1;
  cin >> a >> b;
  if (a > b) swap(a, b);
  while (a != b) {
    a++;
    sum += i++;
    if (a == b) break;
    b--;
    sum += j++;
  }
  printf("%d\n", sum);
  return 0;
}
