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