#include <bits/stdc++.h>
using namespace std;
const int maxx = 1000 + 50;
long long DP[maxx];
int main() {
  int n, m;
  cin >> n >> m;
  int t = abs(n - m);
  DP[1] = 1;
  DP[2] = 3;
  for (int i = 3; i <= 1000; i++) DP[i] = DP[i - 1] + i;
  int ans = 0;
  ans = 2 * DP[(t / 2)];
  if (t % 2 == 1) ans += (t / 2) + 1;
  cout << ans;
}
