#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
using namespace std;
const int MaxN = 5e5 + 17;
const int INF = 1e9 + 17;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const double pi = 3.14159265359;
long long get(long long w) { return w * (w + 1) / 2; }
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  long long x, y;
  cin >> x >> y;
  long long m = (x + y) / 2;
  long long w = (x + y) % 2;
  cout << get(abs(m - x)) + get(abs(m - y));
  return 0;
}
