#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
vector<pair<long long int, pair<long long int, long long int> > > ed;
vector<vector<pair<long long int, long long int> > > adj;
priority_queue<pair<long long int, long long int>,
               vector<pair<long long int, long long int> >,
               greater<pair<long long int, long long int> > >
    pq;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int a, b;
  cin >> a >> b;
  long long int diff = abs(a - b);
  long long int ans;
  if (diff % 2 == 0) {
    diff /= 2;
    ans = (diff) * (diff + 1);
    ;
    ;
    ;
    ;
    ;
    ;
    cout << ans;
  } else {
    long long int d1 = diff / 2;
    long long int d2 = diff - d1;
    ans = d1 * (d1 + 1);
    ans /= 2;
    long long int an = (d2 * (d2 + 1));
    an /= 2;
    ans += an;
    cout << ans;
  }
  return 0;
}
