import numpy as np
a = int(input())
d=list(map(int,input().split()))
b=np.array(d)
c=10**9+7
l=[]
for i in range(0,a-1):
    for j in range(i+1,a):
        l.append(np.bitwise_xor(b[i], b[j]))
print(sum(l)%c)