#include <bits/stdc++.h>
long power(long int x, long int y) {
  int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else
    return x * temp * temp;
}
using namespace std;
int main() {
  int a, b, dif, ans, n, m;
  cin >> a >> b;
  dif = abs(a - b);
  if (dif <= 2)
    ans = dif;
  else {
    n = dif / 2;
    m = (dif / 2) + 1;
    ans = ((n * (n + 1)) / 2) + ((m * (m + 1)) / 2);
  }
  cout << ans << endl;
  return 0;
}
