#include <bits/stdc++.h>
using namespace std;
inline int sum(int n) { return (n * (n + 1)) / 2; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, t, a, b;
  cin >> a >> b;
  int x = abs(a - b);
  if (x % 2 == 0) {
    x /= 2;
    cout << 2 * sum(x) << endl;
  } else {
    x /= 2;
    x++;
    cout << sum(x) + sum(x - 1) << endl;
  }
  return 0;
}
