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

sum_a = 0
for i in range(n-1):
    for j in range(i+1, n):
        sum_a += a[i] ^ a[j]
        if sum_a > 1000000007:
            sum_a -= 1000000007

print(sum_a % 1000000007)