#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  int b;
  cin >> a;
  cin >> b;
  int t1 = 0;
  int t2 = 0;
  bool flag = true;
  int ans = 0;
  while (a != b) {
    if (flag) {
      if (a > b) {
        a--;
      } else {
        a++;
      }
      t1++;
      ans += t1;
    } else {
      if (a > b) {
        b++;
      } else {
        b--;
      }
      t2++;
      ans += t2;
    }
    flag = !flag;
  }
  cout << ans << endl;
}
