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

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
	let n: usize = read();
	let mut a_s: Vec<usize> = Vec::new();
	for _ in 0..n {
		a_s.push(read());
	}

	let mut global_sum = 0;

	for i in 1..n {
		println!("{}", global_sum);
		let mut sum = 0;
		for j in (i+1)..(n+1) {
			sum += a_s[i-1] ^ a_s[j-1]
		}
		global_sum += sum
	}
	println!("{}", global_sum % (10usize.pow(9)+7));
}
