#include <bits/stdc++.h>
using namespace std;
long long a, b, c, res;
int main() {
  cin >> a >> b;
  c = max(a - b, b - a) / 2;
  res = c * (c + 1);
  if ((a - b) & 1) res += c + 1;
  cout << res;
  return 0;
}
