#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int a, b, d, k, string, s;
  cin >> a >> b;
  d = abs(a - b);
  k = 1;
  s = 0;
  string = 0;
  while (d--) {
    s += 1;
    if (string == 1) {
      k++;
      string = 0;
    }
    string = 1;
  }
  cout << s << endl;
  return 0;
}
