#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, f = 0, f2 = 0, c = 1, d = 1;
  cin >> x >> y;
  if (x > y) {
    swap(x, y);
  }
  while (1) {
    if (y - x == 1) {
      f += c;
      break;
    }
    x++;
    f += c;
    c++;
    y--;
    f2 += d;
    d++;
    if (x == y) {
      break;
    }
  }
  cout << f + f2;
}
