#include <bits/stdc++.h>
long long Abs(long long x) {
  if (x < 0) return -x;
  return x;
}
int main() {
  long long a, b;
  scanf("%lld %lld", &a, &b);
  long long mid = (a + b) >> 1;
  long long ans = Abs(mid - a) * (Abs(mid - a) + 1) / 2;
  ans += Abs(mid - b) * (Abs(mid - b) + 1) / 2;
  printf("%lld\n", ans);
  return 0;
}
