fn main() {
    let n = read::<usize>();
    let v = read_vec::<u64>();
    const MOD: u64 = 1000000007;

    let mut ret = 0;
    for i in 0..n-1 {
        for j in i+1..n {
            let tmp = v[i] ^ v[j];
            ret += tmp;
            ret %= MOD;
        }
    }

    println!("{}", ret);
}

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

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()
}
