#include <bits/stdc++.h>
using namespace std;
int Max(int a, int b) { return a > b ? a : b; }
int Min(int a, int b) { return a < b ? a : b; }
inline int read() {
  int xx = 0, ff = 1;
  char cc = getchar();
  while (cc < '0' || cc > '9') {
    if (cc == '-') ff = -1;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') {
    xx = (xx << 3) + (xx << 1) + cc - '0';
    cc = getchar();
  }
  return xx * ff;
}
int a, b, c = 1, d;
int main() {
  a = read();
  b = read();
  if (a > b) swap(a, b);
  while (a != b) {
    a++;
    d += c;
    if (a == b) break;
    b--;
    d += c;
    c++;
  }
  printf("%d\n", d);
  return 0;
}
