#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int check2 = abs(a - b);
  if (check2 == 1) {
    printf("1\n");
    return 0;
  } else {
    int check = abs(a - b) - 1;
    int sum = 0, c = 0;
    for (int i = 1;; i++) {
      c++;
      sum = sum + i;
      if (i == 3) {
        i = 1;
      }
      if (check == c) {
        cout << sum + 1 << endl;
        return 0;
      }
    }
  }
  return 0;
}
