const NOD: u64 = 1000000000 + 7;

fn read_vec<T: std::str::FromStr>() -> Vec<T>
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn xor_series(src :&Vec<u64>, idx: usize, n: usize) -> u64
{
    let mut ret :u64 = 0;
    for i in (idx+1)..n {
        ret += {src[idx] ^ src[i]};
    }
    ret % NOD
}

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n :usize = n.trim().parse().ok().unwrap();

    let src :Vec<u64> = read_vec();
    //let mut xor :Vec<u32> = Vec::with_capacity(n);
    let mut xor_sum :u64 = 0;
    for i in 0..(n-1) {
        //xor.push(xor_series(&src, i, n);
        xor_sum += xor_series(&src, i, n);
    }
    println!("{}", xor_sum % NOD);
}
