#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long OO = (long long)1e18;
const int dx[] = {0, 1, -1, 0, 1, -1, 1, -1};
const int dy[] = {1, 0, 0, -1, 1, -1, -1, 1};
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long fast_power(double base, long long power) {
  if (power == 1) return base;
  if (power % 2 == 0)
    return fast_power((base * base), power / 2);
  else
    return (base * fast_power((base * base), power / 2));
}
void Qalbaz() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(2);
}
int main() {
  Qalbaz();
  int a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  long long ans = 0, k = 1;
  while (b - a >= 2) {
    ans = ans + k * 2;
    a++, b--;
    k++;
  }
  if (a != b) ans += k;
  cout << ans;
  return 0;
}
