#include <bits/stdc++.h>
using namespace std;
int main() {
  ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  int a = abs(n - m) / 2;
  int b = abs(n - m) - a;
  cout << a * (a + 1) / 2 + b * (b + 1) / 2;
}
