#include <bits/stdc++.h>
using namespace std;
int n, m;
int solve(int x) {
  int ans = 0;
  for (int i = 1; i <= x; i++) {
    ans += i;
  }
  return ans;
}
int main() {
  cin >> n >> m;
  cout << solve(abs(n - m) / 2) + solve(abs(n - m) - abs(n - m) / 2);
  return 0;
}
