#include <bits/stdc++.h>
using namespace std;
const int N = 4e4 + 5;
int n, m;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> n >> m;
  int x, cnt = 0;
  if (n > m)
    x = n - m;
  else
    x = m - n;
  if (x == 1)
    cout << 1;
  else if (x % 2 == 0) {
    for (int i = 1; i <= x / 2; i++) cnt += i;
    for (int i = 1; i <= x / 2; i++) cnt += i;
    cout << cnt;
  } else {
    for (int i = 1; i <= x / 2; i++) cnt += i;
    for (int i = 1; i <= x / 2 + 1; i++) cnt += i;
    cout << cnt;
  }
  return 0;
}
