import copy
from collections import deque
import bisect
import fractions
import math
import itertools

N=int(input())
A=list(map(int, input().split()))

sum = 0
for a in list(itertools.combinations(A,2)):
    sum += a[0] ^ a[1]
    sum = sum%(10**9+7)

print(sum)
