input itertools
count = int(input())
waru = 10**9 + 7
intlist = list(map(int,input().split()))
sum = 0
kumi = list(itertools.combinations(intlist,2))
for i in range(count):
    sum+=kumi[i][0]^kumi[i][1]
print(sum%waru)
