#include <bits/stdc++.h>
using namespace std;
const int INF = (int)2e9;
const double EPS = (double)1e-9;
const double PI = (double)acos(-1.0);
const long long MOD = (long long)1e9 + 7;
void base() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
long long n, k, arr[100005], ans;
int main() {
  string str;
  int a, b;
  cin >> a >> b;
  int mn = min(a, b);
  int mx = max(a, b);
  int av = (a + b) / 2;
  ans = 0;
  long long c = 1;
  for (int i = mn; i < av; i++) {
    ans += c;
    c++;
  }
  c = 1;
  for (int i = mx; i > av; i--) {
    ans += c;
    c++;
  }
  cout << ans << endl;
  return 0;
}
