import numpy as np
a = int(input())

d=list(map(int,input().split()))
#b = np.insert(d)
b=np.zeros(a,dtype=np.int)
for i in range(a):
    b[i]=d[i]
#d=np.insert(b,)
c=10**9+7
l=[]
# for i in range(a):
#     b[i]=b[i]%c

for i in range(0,a-1):
    for j in range(i+1,a):
        l.append(np.bitwise_xor(b[i], b[j]) )
        #l.append(b[i]^b[j])

print(sum(l)%c)