#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, count = 1, count_c = 1, count_d = 1, tiredness = 0;
  cin >> a;
  cin >> b;
  if (a < b) {
    c = a;
    d = b;
  } else {
    c = b;
    d = a;
  }
  while (c != d) {
    if (count % 2 == 1) {
      c++;
      tiredness = tiredness + count_c;
      count_c++;
      count++;
    } else {
      d--;
      tiredness = tiredness + count_d;
      count_d++;
      count++;
    }
  }
  cout << tiredness << endl;
}
