#include <bits/stdc++.h>
int main() {
  int a;
  int b;
  std::cin >> a >> b;
  if (a == b) {
    std::cout << '0' << std::endl;
    return 0;
  }
  int dist;
  if (a > b)
    dist = a - b;
  else
    dist = b - a;
  long long total = 0;
  for (int i = 1; i <= dist / 2; ++i) {
    total += i * 2;
  }
  if (dist % 2 == 0) {
    std::cout << total << std::endl;
    return 0;
  } else {
    total += (dist / 2) + 1;
    std::cout << total << std::endl;
  }
  return 0;
}
