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