import std.conv, std.functional, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.numeric, std.range, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


int binomMod2(long n, long k) {
  return ((n & k) == k) ? 1 : 0;
}

// XOR{ x + k | C(y, k) is odd }
long calcBrute(long x, long y) {
  const lim = cast(size_t)(y + 1);
  auto bn = new int[][lim];
  foreach (i; 0 .. lim) {
    bn[i] = new int[i + 1];
    bn[i][0] = bn[i][i] = 1;
    foreach (j; 1 .. i) {
      bn[i][j] = bn[i - 1][j - 1] ^ bn[i - 1][j];
    }
  }
  long ret;
  foreach (k; 0 .. y + 1) {
    if (bn[cast(size_t)(y)][cast(size_t)(k)]) {
      ret ^= (x + k);
    }
  }
  return ret;
}
long calc(long x, long y) {
  long ret;
  for (long l = 1; l - x <= y; l <<= 1) {
    if (y <= l && binomMod2(x, l - y)) {
      ret ^= l;
    }
  }
  return ret;
}


enum BIG = 2 * 10L^^17;

int N;
long[] X, Y;

void main() {
  /*
  foreach (x; 0 .. 100) foreach (y; 0 .. 100) {
    const brt = calcBrute(x, y);
    const res = calc(x, y);
    // writefln("x = %s, y = %s: brt = %s, res = %s", x, y, brt, res);
    assert(brt == res);
  }
  */
  
  /*
  foreach (y; 1 .. 20) {
    auto dp = new int[][](100, y + 1);
    dp[0][] = 1;
    foreach (j; 1 .. 100) {
      dp[j][y] = 1;
      foreach_reverse (k; 1 .. y) {
        dp[j][k] = dp[j - 1][k] ^ dp[j][k + 1];
      }
      dp[j][0] = dp[j][1];
    }
    writeln("y = ", y);
    foreach (k; 0 .. y + 1) {
      write("  ");
      foreach (j; 0 .. 100) {
        write(dp[j][k]);
      }
      writeln();
    }
  }
  */
  
  try {
    for (; ; ) {
      N = readInt();
      X = new long[N];
      Y = new long[N];
      foreach (i; 0 .. N) {
        X[i] = readLong();
        Y[i] = readLong();
      }
      
      long sum;
      
      foreach (i; 0 .. N) {
        if (Y[i] >= 0) {
          sum ^= calc(BIG + X[i], Y[i]);
        }
      }
      
      alias Pt = Tuple!(long, "x", long, "y");
      auto set = new RedBlackTree!(Pt, "[a.y, a.x] < [b.y, b.x]")();
      foreach (i; 0 .. N) {
        if (Y[i] < 0) {
          set.insert(Pt(X[i], Y[i]));
        }
      }
      for (; !set.empty; ) {
        debug {
          foreach (p; set) {
            writef("(%s,%s)", p.x, p.y);
          }
          writeln();
        }
        const pL = set.front;
        set.removeFront;
        assert(!set.empty);
        const pR = set.front;
        set.removeFront;
        assert(pL.y == pR.y);
        for (long l = pL.x, n = pR.x - pL.x; n; n &= (n - 1)) {
          const h = n & -n;
          const p = Pt(l, pL.y + h);
          if (p.y >= 0) {
            sum ^= calc(BIG + p.x, p.y);
          } else {
            if (!set.insert(p)) {
              set.removeKey(p);
            }
          }
          l += h;
        }
      }
      
      const ans = sum - BIG;
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}
