#include <bits/stdc++.h>
using namespace std;
template <class T>
using uset = unordered_set<T>;
template <class T>
using mset = multiset<T>;
template <class T>
using umset = unordered_multiset<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
template <class T>
using maxpq = priority_queue<T, vector<T>, less<T>>;
const int MOD = 1e9 + 7;
template <class T>
void add(T& a, const T& b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
template <class T>
void sub(T& a, const T& b) {
  a -= b;
  if (a >= MOD) a -= MOD;
}
template <class T>
void mult(T& a, const T& b) {
  a *= b;
  if (a >= MOD) a -= MOD;
}
template <class T>
bool amin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool amax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
T sqr(T x) {
  return x * x;
}
template <typename T>
T cdiv(T a, T b) {
  return a / b + !(a < 0 || a % b == 0);
}
template <typename T>
T lcm(T a, T b) {
  return (a * b) / __gcd(a, b);
}
template <class A>
void re(complex<A>& c);
template <class A, class B>
void re(pair<A, B>& p);
template <class A>
void re(vector<A>& v);
template <class A, size_t SZ>
void re(array<A, SZ>& a);
template <class T>
void re(T& x) {
  cin >> x;
}
void re(double& d) {
  string t;
  re(t);
  d = stod(t);
}
void re(long double& d) {
  string t;
  re(t);
  d = stold(t);
}
template <class H, class... T>
void re(H& h, T&... t) {
  re(h);
  re(t...);
}
template <class A>
void re(complex<A>& c) {
  A a, b;
  re(a, b);
  c = {a, b};
}
template <class A, class B>
void re(pair<A, B>& p) {
  re(p.first, p.second);
}
template <class A>
void re(vector<A>& x) {
  for (auto& a : x) re(a);
}
template <class A, size_t SZ>
void re(array<A, SZ>& x) {
  for (auto& a : x) re(a);
}
template <class A>
void pr(A x) {
  cout << x;
}
template <class H, class... T>
void pr(const H& h, const T&... t) {
  pr(h);
  pr(t...);
}
void pln() { pr("\n"); }
template <class H, class... T>
void pln(const H& h, const T&... t) {
  pr(h);
  pln(t...);
}
void ps() { pr("\n"); }
template <class H, class... T>
void ps(const H& h, const T&... t) {
  pr(h);
  if (sizeof...(t)) pr(" ");
  ps(t...);
}
template <class A>
void pr(vector<A> x) {
  for (auto a : x) pr(a, " ");
}
template <class A>
void pln(vector<A> x) {
  for (auto a : x) pr(a, " ");
  pln();
}
string to_string(char c) { return string(1, c); }
string to_string(bool b) { return b ? "true" : "false"; }
string to_string(const char* s) { return (string)s; }
string to_string(string s) { return s; }
template <class A>
string to_string(complex<A> c) {
  stringstream second;
  second << c;
  return second.str();
}
string to_string(vector<bool> v) {
  string res = "{";
  for (int i = (0); i < (((int)v.size())); ++i) res += char('0' + v[i]);
  res += "}";
  return res;
}
template <size_t SZ>
string to_string(bitset<SZ> b) {
  string res = "";
  for (int i = (0); i < (SZ); ++i) res += char('0' + b[i]);
  return res;
}
template <class A, class B>
string to_string(pair<A, B> p);
template <class T>
string to_string(T v) {
  bool fst = 1;
  string res = "{";
  for (const auto& x : v) {
    if (!fst) res += ", ";
    fst = 0;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <class A, class B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
#pragma GCC diagnostic ignored "-Wunused-result"
void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(), "w", stdout); }
void unsyncIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
void setIO(string s = "") {
  unsyncIO();
  if (((int)s.size())) {
    setIn(s + ".in"), setOut(s + ".out");
  }
}
template <class H>
void DBG(const char* sdbg, H h) {
  cerr << sdbg << " = " << to_string(h) << "]" << endl;
}
template <class H, class... T>
void DBG(const char* sdbg, H h, T... t) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << " = " << to_string(h) << ", ";
  DBG(sdbg + 1, t...);
}
const double pi = acos(-1.0);
const int INF = 1e9 + 7;
const long long llINF = ((long long)1e18) + 7LL;
const int mxN = 1e5 + 7;
int main() {
  setIO();
  int a, b;
  re(a, b);
  int mid = a + (b - a) / 2;
  int idx = 0;
  int tiredness = 0;
  while (a != mid) {
    if (a > mid)
      --a;
    else
      ++a;
    tiredness += ++idx;
  }
  int idy = 0;
  while (b != mid) {
    if (b > mid)
      --b;
    else
      ++b;
    tiredness += ++idy;
  }
  pln(tiredness);
}
