#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int a, b;
  scanf("%d%d", &a, &b);
  if (a > b) {
    swap(a, b);
  }
  int dis = (b - a);
  int cnta = 1, cntb = 1;
  long long ans = 0;
  while (dis) {
    if (cnta < cntb) {
      ans += cnta;
      cnta++;
    } else {
      ans += cntb;
      cntb++;
    }
    dis--;
  }
  std::cout << ans << '\n';
  return 0;
}
