#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, result = 0, fol = 0, m;
  cin >> n >> m;
  if (n < m)
    result = m - n;
  else
    result = n - m;
  int temp;
  if (result == 1)
    fol = 1;
  else if (result == 2)
    fol = 2;
  else if (result % 2) {
    for (int i = 1; i <= result / 2; i++) {
      temp = i;
      fol += i;
    }
    fol = fol * 2 + (temp + 1);
  } else {
    for (int i = 1; i < result / 2; i++) fol += i;
    fol *= 2;
  }
  cout << fol << endl;
  return 0;
}
