import std.functional,
       std.algorithm,
       std.container,
       std.typetuple,
       std.typecons,
       std.bigint,
       std.string,
       std.traits,
       std.array,
       std.range,
       std.stdio,
       std.conv;

int f(uint x) {
  int t = (x + 1) / 2;
  if ((x + 1) % 2 == 0) {
    return t % 2;
  } else {
    return (t % 2) ^ x;
  }
}

void main() {
  int[] AB = readln.chomp.split.to!(int[]);
  int A = AB[0],
      B = AB[1];
  int ans = f(B);

  if (A > 0) {
    ans ^= f(A - 1);
  }

  writeln(ans);
}