#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, z, b, d, e, g, y, m, x, sum = 0;
  cin >> n >> m;
  y = (n + m) / 2;
  n = abs(n - y);
  m = abs(m - y);
  for (int i = 1; i < n + 1; i++) sum = sum + i;
  for (int i = 1; i < m + 1; i++) sum = sum + i;
  cout << sum;
}
