mod = 10**9+7

def xor(a, b):
    A = str(bin(a))
    B = str(bin(b))

    A = A[2:]
    B = B[2:]

    if len(A) >= len(B):
        n = len(A)
        for i in range(len(A) - len(B)):
            B = '0' + B
    else:
        n = len(B)
        for i in range(len(B) - len(A)):
            A = '0' + A

    C = ''

#    print('A = {}, B = {}'.format(A, B))

    for i in range(n):
        if A[i] == B[i]:
            C = C + '0'
        else:
            C = C + '1'

    return int(C, 2) % mod


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

ans = 0

for i in range(n):
    for j in range(n-i-1):
        ans = (ans + xor(a[i], a[i+j+1])) % mod
        print('xor(a[{}], a[{}]) = {}'.format(i, i+j+1, xor(a[i], a[i+j+1])))

print(ans%(mod))
