#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, sum, step = 0, diff, loop = 1;
  cin >> x, y;
  if (x > y) {
    while (x != y) {
      x--;
      sum++;
      if (x > y) {
        y++;
        sum++;
      }
      diff = x - y;
      step = step + loop * diff;
      if (diff == 0) {
        step = step + sum * loop;
        break;
      }
      loop++;
    }
    cout << step;
  } else {
    while (x != y) {
      y--;
      sum++;
      if (x < y) {
        x++;
        sum++;
      }
      diff = x - y;
      step = step + loop * diff;
      if (diff == 0) {
        step = step + sum * loop;
        break;
      }
      loop++;
    }
    cout << step;
  }
}
