#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b, m, x, y;
  cin >> a >> b;
  m = (a + b) / 2;
  x = abs(m - a);
  y = abs(m - b);
  cout << x * (x + 1) / 2 + y * (y + 1) / 2 << "\n";
}
int32_t main() {
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  }
  long long t = 1;
  while (t--) solve();
  return 0;
}
