#include <bits/stdc++.h>
using namespace std;
int main() {
  int n1, n2, count = 0, index = 1;
  cin >> n1 >> n2;
  while (n1 != n2) {
    if (n1 < n2) {
      count += index;
      index++;
      n1 += 1;
    }
    if (n1 > n2) {
      count += index;
      index++;
      n1 -= 1;
    }
    if (n2 > n1) {
      count += index;
      index++;
      n2 -= 1;
    }
    if (n2 < n1) {
      count += index;
      index++;
      n2 += 1;
    }
  }
  cout << count << endl;
}
