#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int x = abs(a - b);
  int ans = 0;
  if (x % 2 == 0) {
    int q = x / 2;
    for (int k = 1; k <= q; k++) {
      ans += k;
    }
    cout << ans * 2;
    return 0;
  } else {
    int q = x / 2;
    int k = 1;
    for (k = 1; k <= q; k++) {
      ans += k;
    }
    cout << (2 * ans) + k;
    return 0;
  }
  return 0;
}
