import strutils, sequtils, math, algorithm

let n = stdin.readLine.parseInt
let a = stdin.readLine.split.map(parseInt)

const M = 1_000_000_007
var c = 0

for i in 1..n-1:
  for j in i+1..n:
    c += (a[i-1] xor a[j-1]) mod M
    c = c mod M

echo c