from functools import reduce

n = int(input())
A = list(map(int, input().split()))
s = 0

def xor(a, b):
    return a ^ b
for i in range(n-1):
    for j in range(i+1, n):
        s += xor(A[i],A[j])%(10**9+7)
s = s % (10**9+7)
print(s)