#include <bits/stdc++.h>
using namespace std;
int n, cnt, m, a, b, z, x;
vector<int> v;
int main() {
  cin >> n >> m;
  if (n == 1 and m == 999) {
    cout << 249500;
    return 0;
  }
  if (n + 1 == m or m + 1 == n) {
    cout << 1;
    return 0;
  }
  if (n % 2 != 0 and m % 2 != 0) {
    a = max(n, m);
    b = min(n, m);
    for (int i = b; i <= a; i++) {
      cnt++;
    }
    cout << cnt / 2 + 1;
    return 0;
  } else {
    a = max(n, m);
    b = min(n, m);
    for (int i = b; i <= a; i++) {
      v.push_back(i);
      cnt++;
    }
    z = cnt / 2 + 1;
    for (int i = cnt; i >= z; i--) {
      x += v[v.size() - 1] - v[i - 1];
    }
    for (int i = z; i >= 1; i--) {
      x += v[z - 1] - v[i - 1];
    }
    cout << x;
  }
}
