#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  int getval = abs(x - y);
  int total = 0;
  if (getval % 2 == 0) {
    int avg = getval;
    for (int i = 0; i <= avg / 2; i++) {
      total += i;
    }
    cout << total * 2 << endl;
  } else {
    float temp = ceil(abs(x - y) / 2);
    int temp2 = temp;
    int insidetotal = 0;
    for (int i = 0; i <= temp2; i++) {
      insidetotal += i;
    }
    for (int i = 0; i <= temp2 - 1; i++) {
      insidetotal += i;
    }
    cout << insidetotal << endl;
  }
  return 0;
}
