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