#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  if (a > b) {
    int t = a;
    a = b;
    b = t;
  }
  int x = (a + b) / 2;
  int m = x - a, n = b - x;
  int c = 0;
  for (int i = 1; i <= m; i++) c += i;
  for (int i = 1; i <= n; i++) c += i;
  cout << c << endl;
}
