#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x, y;
  int ans;
  while (scanf("%d%d", &a, &b) != EOF) {
    if (a < b) swap(a, b);
    x = a - b;
    if (x == 1) printf("1\n");
    if (x == 2) printf("2\n");
    if (((x & 1) == 0) && (x != 2)) {
      x = x / 2;
      for (int i = 0; i < x; i++) {
        y += i;
      }
      ans = 2 * y;
      printf("%d\n", ans);
    } else if (((x & 1) == 1) && (x != 1)) {
      x = x / 2;
      for (int i = 0; i < x; i++) {
        y += i;
      }
      ans = 2 * y + (x + 1);
      printf("%d\n", ans);
    }
  }
}
