import math

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

m = int(math.log2(max(a))) + 1

total = 0
num = 1
while True:
    if num == n:
        break
    p, q = 0, 0
    for i in range(0, n - num):
        p += a[i] << m * (n-num-i-1)
        q += a[num + i] << m * (n-num-i-1)
    r = p ^ q
    for i in range(0, n - num):
        total += (r % (2 ** m)) % 1000000007
        r = r >> m
    num += 1

print(total % 1000000007)