#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  if (n > m) {
    swap(n, m);
  }
  int cnt = 0, cnt1 = 0;
  int i = 1;
  while (1) {
    n++;
    cnt += i;
    if (n == m) break;
    m--;
    cnt += i;
    if (n == m) break;
    i++;
  }
  printf("%d", cnt + cnt1), printf("\n");
  return 0;
}
