#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (cin >> n >> m) {
    long long ans = 0;
    int te = 1;
    int fl = 0;
    int len = abs(n - m);
    if (len % 2 == 1) {
      fl = 1;
      len--;
    }
    len /= 2;
    for (int i = 1; i <= len; i++) ans += i;
    ans *= 2;
    if (fl) ans += (len + 1);
    cout << ans << endl;
  }
  return 0;
}
