n = int(input())
a = list(map(int, input().split()))
count = 0

for i in range(n-1):
    for j in range(i+1,n):
        count += (a[i] ^ a[j]) % (10**9+7)
        #print(a[i],a[j])

print(count % (10**9+7))