#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  int tiredness = 0;
  cin >> a >> b;
  int mid = (a + b) / 2;
  if (a < b) {
    int i = 1, j = 1;
    while (a < mid) {
      tiredness += i;
      a++;
      i++;
    }
    while (b > mid) {
      tiredness += j;
      b--;
      j++;
    }
  } else {
    int i = 1, j = 1;
    while (a > mid) {
      tiredness += j;
      a--;
      i++;
    }
    while (b < mid) {
      tiredness += j;
      b++;
      j++;
    }
  }
  cout << tiredness << endl;
  return 0;
}
