#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a == b) {
    puts("0");
    return 0;
  }
  int maxx = max(a, b);
  int minn = min(a, b);
  if (maxx - minn < 1) {
    puts("2");
    return 0;
  }
  int tmp = maxx - minn;
  long long res = 0;
  if (tmp & 1) {
    for (int i = 1; i <= (tmp - 1) / 2; i++) {
      res += i;
    }
    res *= 2;
    res += (tmp - 1) / 2 + 1;
  } else {
    for (int i = 1; i <= tmp - 1; i++) {
      res += i;
    }
    res *= 2;
  }
  cout << res << endl;
}
