#include <bits/stdc++.h>
using namespace std;
long long fpow(long long n, long long k, long long p = 1000000007) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
long long inv(long long a, long long p = 1000000007) {
  return fpow(a, p - 2, p);
}
int main() {
  long long n, m;
  cin >> n;
  cin >> m;
  long long temp = (n + m) / 2;
  long long q = abs(n - temp);
  long long ans = 0;
  ans += (q * (q + 1)) / 2;
  q = abs(m - temp);
  ans += (q * (q + 1)) / 2;
  cout << ans << "\n";
}
