#include <bits/stdc++.h>
using namespace std;
int n, k, a, b;
double l, v1, v2;
string s;
template <class T>
ostream& operator<<(ostream& out, vector<T> v) {
  out << v.size() << '\n';
  for (auto e : v) out << e << ' ';
  return out;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> a >> b;
  int x = abs(a - b);
  if (x % 2 == 0)
    cout << x * (x + 1);
  else
    cout << x * (x - 1) + x / 2 + 1;
}
