#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) {
    int y = x / 2;
    cout << (1 + y) * y << endl;
  } else {
    int y = x / 2;
    cout << (1 + y) * y + y + 1 << endl;
  }
}
