use std::io::Read;
const MOD: u64 = 1_000_000_007;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<u64> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    let mut ans: u64 = 0;
    let mut xor: Vec<u64> = vec![0; n];
    for i in 0..n {
        xor[i] = a[0] ^ a[i];
        ans = (ans + (a[0] ^ a[i])) % MOD;
    }
    for i in 1..n - 1 {
        for j in i + 1..n {
            ans = (ans + (xor[i] ^ xor[j])) % MOD;
        }
    }
    println!("{}", ans);
}