#include <bits/stdc++.h>
using namespace std;
int read() {
  int a = 0, b = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') b = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') a = a * 10 + c - 48, c = getchar();
  return a * b;
}
int a, b;
int ans = 0;
int main() {
  a = read(), b = read();
  if (a > b) swap(a, b);
  int mid = (a + b) / 2;
  for (int i = 1; a + i <= mid; i++) ans += i;
  for (int i = 1; b - i >= mid; i++) ans += i;
  cout << ans << '\n';
  return 0;
}
