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