#include <bits/stdc++.h>
int main() {
  int temp;
  int a, b;
  int mid;
  int sum1, sum2;
  while (scanf("%d\n%d\n", &a, &b) != EOF) {
    if (a > b) {
      temp = a;
      a = b;
      b = temp;
    }
    mid = (a + b) / 2;
    sum1 = mid - a;
    sum2 = b - mid;
    sum1 = (1 + sum1) * sum1 / 2;
    sum2 = (1 + sum2) * sum2 / 2;
    printf("%d\n", sum1 + sum2);
  }
  return 0;
}
