import sequtils, strutils, algorithm, math

var N = stdin.readline.parseInt
var A = stdin.readline.split.map(parseInt)

var ans = 0
var MOD = 10^9+7

for i in 0..<N-1:
  for j in (i+1)..<N:
    ans += ((A[i] xor A[j]) mod MOD)

echo ans 