#include <bits/stdc++.h>
using namespace std;
int moveing(int n) {
  int tired = 0;
  for (int i = 1; i <= n; i++) tired += i;
  return tired;
}
int main() {
  int n, m, out = 0;
  cin >> n >> m;
  int dist = abs(n - m);
  int lol = moveing(dist / 2);
  if (dist % 2 == 0)
    out = lol * 2;
  else if (lol != 0)
    out = lol + moveing(dist / 2 + 1);
  else
    out = 1;
  cout << out;
  return 0;
}
