#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  if (b - a == 1) {
    cout << b - a;
    return 0;
  }
  vector<int> z(b - a + 1), z1(b - a + 1), z2(b - a + 1);
  z[0] = 0;
  for (int i = 1; i < b - a; i++) z[i] = z[i - 1] + i;
  z1[b - a] = 0;
  for (int i = b - a - 1; i >= 1; i--) z1[i] = z1[i + 1] + b - a + 1 - i - 1;
  for (int i = 1; i < b - a; i++) z2[i] = z1[i] + z[i];
  int min_z = 100000000;
  for (int i = 1; i < b - a; i++)
    if (z2[i] < min_z) min_z = z2[i];
  cout << min_z;
}
