#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
long long int MOD = 998244353;
long long int NUM = 1e9 + 7;
void solve() {
  int a, b;
  cin >> a >> b;
  int mid = (a + b) / 2, x, y;
  x = abs(a - mid), y = abs(b - mid);
  cout << (x * (x + 1)) / 2 + (y * (y + 1)) / 2 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) solve();
  return 0;
}
