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