#include <bits/stdc++.h>
using namespace std;
int main() {
  long a, b;
  cin >> a >> b;
  a = a - b;
  long cnt1 = a / 2;
  long cnt2 = a - cnt1;
  cout << cnt1 * (cnt1 + 1) / 2 + cnt2 * (cnt2 + 1) / 2;
}
