#include <bits/stdc++.h>
using namespace std;
long long n, cnt, ans, m, a, b, z, x;
vector<int> v;
int main() {
  cin >> n >> m;
  cnt = 1;
  b = 1;
  z = 10000;
  while (z) {
    if (n == m) break;
    if (a == 0) {
      if (n > m)
        n--;
      else
        n++;
      ans += cnt;
      cnt++;
      a = 1;
    } else {
      if (m > n)
        m--;
      else
        m++;
      ans += b;
      b++;
      a = 0;
    }
    z--;
  }
  cout << ans << endl;
}
