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

pub 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 = read::<usize>();
    let a: Vec<usize> = (0..n).map(|_| read::<usize>()).collect();

    let mut ans = 0;
    for i in 0..n-1 {
        for j in i..n {
            ans += a[i] ^ a[j];
            ans %= 1000000007;
        }
    }
    println!("{}", ans);
}
