use std::io;
use std::str::FromStr;

const MOD: u64 = 1000000007;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}


fn main() {
    let n: usize = input();
    let a_vec = input_vec();
    let mut sum = 0;
    for i in 0..n {
        for j in (i+1)..n {
            sum += a_vec[i] ^ a_vec[j];
            if sum > MOD {
                sum %= MOD;
            }
        }
    }
    println!("{}", sum);
}
