#include <bits/stdc++.h>
using namespace std;
long long n, m = 0, k = 0;
bool test = false, test1 = false;
long long const N = 1e5 + 7;
long long const oo = 1000000007;
long long nChoosek(long long n, long long k) {
  if (k > n) return 0;
  if (k * 2 > n) k = n - k;
  if (k == 0) return 1;
  long long result = n;
  for (long long i = 2; i <= k; ++i) {
    result *= (n - i + 1);
    result /= i;
  }
  return result;
}
vector<long long> v, v1;
vector<pair<long long, long long> > vv;
map<pair<long long, long long>, long long> my1;
map<long long, long long> my;
priority_queue<long long> q;
long long t[N];
long long dx[4] = {0, 1, 0, -1};
long long dy[4] = {1, 0, -1, 0};
vector<long long> v2[N];
long long z[N];
void dfs(long long s) {
  if (z[s]) return;
  z[s] = 1;
  for (long long u = 0; u < v2[s].size(); u++) {
    dfs(v2[s][u]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i = 0, j = 0, a = 0, b = 0, c = 0, d = -1e18, x = 0, y = 0, s = 0,
            r, l;
  string s1, s2, s3, s4, s5;
  cin >> a >> b;
  c = abs(a - b);
  if (c == 0) {
    cout << 0;
    return 0;
  }
  k = c / 2;
  if (c % 2)
    d = k + 1;
  else
    d = k;
  cout << (d * (d + 1)) / 2 + (k * (k + 1)) / 2;
  return 0;
}
