#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int main() {
  int n, m;
  cin >> n >> m;
  int x = abs(n - m);
  if (x % 2 == 0) {
    cout << (1 + x / 2) * x / 2 << endl;
  } else {
    cout << (1 + x / 2) * x / 2 + x / 2 + 1 << endl;
  }
}
