#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, sum = 0;
  cin >> a >> b;
  int d = abs(a - b) / 2;
  for (int i = 1; i <= d; i++) sum += i;
  sum *= 2;
  if (abs(a - b) % 2 != 0) sum += (d + 1);
  cout << sum;
  return 0;
}
