#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b;
  cin >> a >> b;
  if (b < a) swap(a, b);
  long long lik = 1, ans = 0;
  if ((b - a) % 2 == 0) {
    while (a != b) {
      a++;
      b--;
      ans += lik * 2;
      lik++;
    }
    cout << lik;
  } else {
    b--;
    while (a != b) {
      a++;
      b--;
      ans += lik * 2;
      lik++;
    }
    ans += lik;
    cout << ans;
  }
}
int main() {
  solve();
  return 0;
}
