#include <bits/stdc++.h>
using namespace std;
long long int a = 0, n = 0, b = 0, m = 0;
string s;
bool turimi(long long int n, long long int k) {
  long long int c = 0, r = 0;
  while (n) {
    if (n % 2) c++;
    n /= 2;
  }
  return c <= k;
}
int main() {
  cin >> n >> m;
  while (n != m) {
    a++;
    if (n < m) {
      n++;
      b += a;
      if (n != m) {
        m--;
        b += a;
      }
    } else {
      m++;
      b += a;
      if (n != m) {
        n--;
        b += a;
      }
    }
  }
  cout << b;
  return 0;
}
