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