#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, i, j;
  cin >> a >> b;
  int x1 = min(a, b);
  int x2 = max(a, b);
  int p = 1;
  int c = 0;
  for (i = x1, j = x2; i != j;) {
    i++;
    c = c + p;
    if (i == j) break;
    j--;
    c = c + p;
    if (i == j) break;
    p++;
  }
  cout << c;
}
