import strutils
import sequtils

let N = readLine(stdin).parseInt
let s = readLine(stdin).split(" ").map(proc(x: string): int = x.parseInt)

var sum: int64 = 0
for i in 0..N-2:
    for j in (i)..N-1:
        sum += (s[i] xor s[j])

echo (sum mod 1000000007)
