#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i = 0;
  cin >> n >> m;
  int sum = 0;
  if (abs(n - m) == 1) {
    cout << 1 << endl;
  } else {
    while (n <= m) {
      sum += i + i;
      n += 1;
      m -= 1;
      i++;
    }
    if (abs(n - m) % 2 == 0)
      cout << sum << endl;
    else
      cout << sum + i << endl;
  }
  return 0;
}
