#include <bits/stdc++.h>
using namespace std;
int moox = 0, res = 0;
int aude(int a, int b) {
  if (a - b == 1) {
    res = max(a, moox);
    return res;
  } else {
    return aude(a - 1, b);
    return aude(a, b + 1);
  }
}
int main() {
  int a, b, r, maxx, minn, ii, jj;
  cin >> a;
  cin >> b;
  if (a > b) {
    r = a - b;
    maxx = a;
    ii = a;
    minn = b;
    jj = b;
  } else {
    r = b - a;
    maxx = b;
    ii = b;
    minn = a;
    jj = a;
  }
  for (int i = 0; i < r; i++) {
    maxx--;
    if (maxx == minn) {
      res = maxx;
      break;
    }
    minn++;
    if (maxx == minn) {
      res = maxx;
      break;
    }
  }
  int k = 0;
  int f = 0;
  k = ii - res;
  f = res - jj;
  int xx = 0, yy = 0;
  for (int i = 0; i <= 10; i++) {
    if (k == 0) break;
    xx += k;
    k--;
    if (k == 0) break;
  }
  for (int i = 0; i <= 10; i++) {
    if (f == 0) break;
    yy += f;
    f--;
  }
  cout << yy + xx;
}
