#include <bits/stdc++.h>
using namespace std;
int sum(int x) {
  if (x != 0) return x + sum(x - 1);
}
int main() {
  int a, b;
  cin >> a >> b;
  int avg = (a + b) / 2;
  a = abs(avg - a);
  b = abs(avg - b);
  int ans1 = sum(a);
  int ans2 = sum(b);
  cout << ans1 + ans2 << endl;
}
