n = int(input())

a = list(map(int, input().split()))

sum = 0
count = 0

for i in range(0, n-1):
    for j in range(i+1, n):
        sum = sum + (a[i] ^ a[j])
        count += 1

a = sum % (10**9 + 7)
print(a)