#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() {
  while (~scanf("%lld%lld", &a, &b)) {
    int tmp = abs(a - b);
    bool odd = false;
    if (tmp % 2 != 0) odd = true;
    tmp /= 2;
    int ans = ((1 + tmp) * tmp) / 2;
    ans *= 2;
    if (odd) ans += tmp + 1;
    printf("%d\n", ans);
  }
  return 0;
}
