#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a < b) swap(a, b);
  int t1 = 0, t2 = 0, ptr1 = 1, ptr2 = 1;
  bool turn = 0;
  while (a != b) {
    if (turn) {
      ++b;
      t1 += ptr1++;
    } else {
      --a;
      t2 += ptr2++;
    }
    turn ^= 1;
  }
  printf("%d", t1 + t2);
}
