#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a, b;
  cin >> a >> b;
  if (fabs(a - b) == 1)
    cout << 1;
  else {
    if (a > b) {
      a = a + b;
      b = a - b;
      a = a - b;
    }
    int mid = (a + b) / 2;
    int x, y;
    x = mid - a;
    y = b - mid;
    int steps = x * (x + 1) / 2 + y * (y + 1) / 2;
    cout << steps << "\n";
  }
  return 0;
}
