#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double E = exp(1.0);
const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 10;
const int MOD = 142857;
int main() {
  long long a, b;
  cin >> a >> b;
  long long temp = abs(a - b);
  long long flag = temp % 2;
  temp /= 2;
  long long ans = temp * (temp + 1) / 2;
  ans *= 2;
  if (flag) ans += temp + 1;
  cout << ans << endl;
  return 0;
}
