#include <bits/stdc++.h>
using namespace std;
int flick(int n) { return (n * (n + 1)) / 2; }
int main() {
  long long a, b, x, y;
  cin >> x >> y;
  a = x < y ? x : y;
  b = x > y ? x : y;
  int mid = ((b - a) / 2) + a;
  int n1 = mid - a;
  int n2 = b - mid;
  cout << flick(n1) + flick(n2) << "\n";
  return 0;
}
