N = int(input())
a = map(int, input().split())
A = list(a)
OB = [[0 for i in range(61)] for j in range(N)]

def sumup(num):
    if num == 0:
        return 0
    else:
        return (num + sumup(num-1))

XOR = [[0 for i in range(61)] for j in range(sumup(N-1))]

for n in range(N):
    m = 0
    while A[n] > 0:
        OB[n][60-m] = A[n]%2
        A[n] = A[n]//2
        m = m+1

xor = 0
for n in range(0,(N-1)):
    for k in range(1,(N-n)):
        for m in range(61):
            if abs(OB[n][60-m]-OB[n+k][60-m]) == 1:
                XOR[xor][60-m] = 1
            else:
                XOR[xor][60-m] = 0
        xor = xor+1

summary = 0
for j in range(sumup(N-1)):
    for i in range(61):
        summary = summary + XOR[j][60-i]*(2**(i))
print(summary%(10**9+7))