#include <bits/stdc++.h>
using namespace std;
template <class T, class R>
ostream& operator<<(ostream& os, pair<T, R>& v) {
  os << '(' << v.first << ' ' << v.second << ')' << ' ';
  return os;
}
template <class T>
ostream& operator<<(ostream& os, vector<T>& v) {
  for (auto i : v) os << i << " ";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, set<T>& v) {
  for (auto i : v) os << i << " ";
  return os;
}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
void fastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
}
int main() {
  fastIO();
  int a, b;
  cin >> a >> b;
  int ca = 1, cb = 1;
  int ans = 0;
  if (a > b) swap(a, b);
  while (a != b) {
    if (ca < cb) {
      ans += ca;
      ca++;
      a++;
    } else {
      ans += cb;
      cb++;
      b--;
    }
  }
  cout << ans;
}
