#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int N, K;
  int a, b;
  cin >> a >> b;
  int cont = 0;
  int aa = 1;
  int bb = 1;
  int a1 = min(a, b);
  int a2 = max(a, b);
  while (a1 != a2) {
    a1++;
    cont += aa;
    aa++;
    if (a1 != a2) {
      a1++;
      cont += bb;
      bb++;
    }
  }
  cout << cont;
}
