#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 200000 + 10;
const int mod = 1000000007;
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  int c = abs(a - b);
  int d = c / 2;
  int sum = 0;
  for (int i = 1; i <= d; i++) sum = sum + 2 * i;
  if (c % 2 == 1) sum = sum + d + 1;
  printf("%d\n", sum);
  return 0;
}
