#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, k = 1, sum = 0;
  cin >> a >> b;
  if (a > b) {
    int temp = a;
    a = b;
    b = temp;
  }
  while (a != b) {
    a++;
    sum += k;
    if (a == b) {
      cout << sum;
      return 0;
    }
    b--;
    sum += k;
    k++;
  }
  cout << sum;
  return 0;
}
