#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  cin >> a >> b;
  long long z = abs(a - b);
  long long l, r;
  l = z / 2;
  r = z - l;
  cout << l * (l + 1) / 2 + r * (r + 1) / 2 << endl;
}
