import copy
num = int(input())
line = input().split()
count = 0
for i in range(0,num-1):
    for j in range(i+1,num):
        x = int(line[i])
        y = int(line[j])
        z = x^y
        count += z
p = copy.copy(count)
for i in range(9):
    p = p/10

if int(p)>=1:
    t = count-int(p)*(10^9+7)
    if t>=0:
        count = t
    else:
        count = count - (int(p)-1)*(10^9+7)


print(count)
