#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int dist = abs(a - b);
  int ans = 0;
  for (int i = 1; i <= dist / 2; i++) {
    ans += i;
  }
  ans *= 2;
  if (dist % 2 == 1) ans += dist / 2 + 1;
  cout << ans;
}
