#include <bits/stdc++.h>
using namespace std;
int n, m, ans, sum, x, y, cnt, cnt1;
int main() {
  cin >> n >> m;
  ans = (n + m) / 2;
  if (ans < n) {
    x = ans;
    y = n - x;
    for (int i = 1; i <= y; i++) cnt += i;
  }
  if (ans > n) {
    x = n;
    y = ans - n;
    for (int i = 1; i <= y; i++) cnt += i;
  }
  if (ans < m) {
    x = ans;
    y = m - ans;
    for (int i = 1; i <= y; i++) cnt1 += i;
  }
  if (ans > m) {
    x = m;
    y = ans - x;
    for (int i = 1; i <= y; i++) cnt1 += i;
  }
  sum = abs(ans - n) + abs(ans - m);
  cout << cnt + cnt1;
}
