#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, A[1002];
  cin >> a >> b;
  A[0] = 0;
  A[1] = 1;
  for (int i = 2; i <= 1001; i++) {
    A[i] += (A[i - 1] + i);
  }
  if (a > b) swap(a, b);
  int dist = b - a;
  if (dist % 2 == 0) {
    dist = dist / 2;
    cout << 2 * A[dist] << endl;
  } else {
    dist = dist / 2;
    cout << A[dist] + A[dist + 1] << endl;
  }
  return 0;
}
