#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int dis = abs(a - b) - 1;
  if (dis == 1) {
    cout << 2 << '\n';
    return 0;
  }
  if (dis % 2 == 0) {
    int x = (dis) / 2;
    cout << 2 * (x * (x + 1) / 2) + x + 1 << '\n';
  } else {
    int x = (dis + 1) / 2;
    cout << 2 * (x * (x + 1) / 2) << '\n';
  }
  return 0;
}
