#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  a = min(a, b);
  b = max(a, b);
  int mid = (a + b) / 2;
  int d1 = mid - a, d2 = b - mid;
  int ans = (d1 * (d1 + 1)) / 2 + (d2 * (d2 + 1)) / 2;
  cout << ans;
}
