#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int x, m, n, y, z, middle1, middle2, middle, sum3 = 0, sum4 = 0;
  x = abs(a - b);
  if (x % 2 == 0) {
    int sum1 = 0, sum2 = 0;
    middle1 = x / 2;
    middle2 = x / 2;
    for (int i = middle1; i > 0; i--) {
      sum1 += i;
    }
    for (int j = middle2; j > 0; j--) {
      sum2 += j;
    }
    y = sum1 + sum2;
  } else {
    middle = x / 2 + 1;
    for (int i = 1; i <= middle; i++) {
      sum3 += i;
    }
    for (int j = 1; j < middle; j++) {
      sum4 += j;
    }
    y = sum3 + sum4;
  }
  printf("%d\n", y);
  return 0;
}
