#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  x = 0;
  int k = 1;
  char c = getchar();
  while ((c != '-') && (c < '0' || c > '9')) c = getchar();
  if (c == '-') k = -1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  x = x * k;
}
void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
void init() { freopen("a.in", "r", stdin); }
int main() {
  int a, b;
  read(a), read(b);
  if (a > b) swap(a, b);
  int len = b - a, ans = 0;
  for (int i = 1; i <= 1000; i++) {
    if (!len) break;
    if (len - 2 > 0)
      ans += i * 2, len -= 2;
    else
      ans += i, len -= 1;
  }
  write(ans);
  return 0;
}
