'use strict';

const input = require("fs").readFileSync("/dev/stdin", "utf8");
const rows = input.trim().split('\n');

const N = Number(rows[0].trim());
const An = rows[1].trim().split(' ').map((v) => {
    return bigInt(v);
});

let sum = bigInt(0);
for (let i = 0; i < N - 1; i++) {
    for (let j = i + 1; j < N; j++) {
        sum = sum.add(An[i].xor(An[j]));
    }
}

const div = bigInt(1000000007);
console.log(sum.mod(div).toString());
