fn getline() -> String {
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

#[allow(unused_macros)]
macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
}

#[allow(unused_macros)]
macro_rules! readlvec {
    ($t: ty) => {
        {
            let s = getline();
            let iter = s.trim().split(' ');
            iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    }
}

#[allow(unused_macros)]
macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn printiter<'a, T>(v: &'a T)
where
    &'a T: std::iter::IntoIterator,
    <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display,
{
    for (i, e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!("");
}


#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, BTreeMap, HashMap, HashSet};
#[allow(unused_imports)]
use std::collections::btree_map::Entry::{Occupied, Vacant};

trait BinarySearch {
    type E;
    fn lower_bound(&self, &(Self::E)) -> usize;
    fn upper_bound(&self, &(Self::E)) -> usize;
}

impl<T> BinarySearch for Vec<T>
        where T: std::cmp::Ord {
    type E = T;

    fn lower_bound(&self, e: &(Self::E)) -> usize {
         if self[0] >= *e {
             0
         } else {
            let mut ng = 0;
            let mut ok = self.len();
            while ok-ng > 1 {
                let m = (ok+ng)/2;
                if self[m] >= *e {
                    ok = m;
                } else {
                    ng = m;
                }
            }
            ok
         }
    }
    
    fn upper_bound(&self, e: &(Self::E)) -> usize {
        if self[0] > *e {
             0
         } else {
            let mut ng = 0;
            let mut ok = self.len();
            while ok-ng > 1 {
                let m = (ok+ng)/2;
                if self[m] > *e {
                    ok = m;
                } else {
                    ng = m;
                }
            }
            ok
         }
    }
}


fn main() {
    use std::io::Write;
    let out = std::io::stdout();
    let mut out = std::io::BufWriter::new(out.lock());
    macro_rules! printf { ($($arg:tt)*) => (write!(out, $($arg)*).unwrap()); }
    macro_rules! printfln { () => (writeln!(out).unwrap()); ($($arg:tt)*) => (writeln!(out, $($arg)*).unwrap()); }

    let n = readl!(usize);
    let a = readlvec!(i64);
    let b = readlvec!(i64);
    let mut ans = 0;
    for i in 0..30 {
        let mut a = a.clone();
        let mut b = b.clone();
        for e in &mut a {
            *e &= (1<<(i+1))-1;
        }
        for e in &mut b {
            *e &= (1<<(i+1))-1;
        }
        a.sort();
        b.sort();
        let a = a;
        let b = b;
        // debug!(a); debug!(b);
        let mut cnt = 0;
        for &e in &a {
            let l = b.lower_bound(&((1<<(i+1))-e));
            // debug!(e); debug!(l);
            let check = |x| ((e+b[x])>>i)&1i64 == 1i64;
            let f = |l: usize, r: usize| {
                if r == l {
                    0
                } else if check(l) {
                    r-l
                } else {
                    let mut ng = l;
                    let mut ok = r;
                    while ok-ng > 1 {
                        let m = (ng+ok)/2;
                        if check(m) {
                            ok = m;
                        } else {
                            ng = m;
                        }
                    }
                    // debug!((ng, ok));
                    r-ok
                }
            };
            // debug!((f(0, l), f(l, n)));
            cnt += f(0, l) + f(l, n);
        }
        // debug!(cnt);
        if cnt&1 == 1 {
            ans += 1<<i;
        }
    }
    printfln!("{}", ans);
}


Measured memory_bytes: 13556