#coding:utf-8
N = int(input())
A = list(map(int,input().split()))
sm = 0
MOD = 1000000007
for i in range(len(A)-1):
    for j in range(i+1,len(A)):
        sm += A[i]^A[j]
        sm = sm % MOD
print (sm)

# print (MOD)
# left = [0]
# for a in A:
#     sm+=a
#     sm = sm % MOD
#     left.append(sm)
# print (left)
# sm = 0
# right = [0]
# for a in A[::-1]:
#     sm+=a
#     sm = sm % MOD
#     right.append(sm)
# right = right[::-1]
# print (right)


# ans = 0
# for i in range(len(A)):
#     sm = left[i]+right[i+1]
#     if (len(A)%2==0):
#         sm = sm^A[i]
#     ans += sm
#     ans = ans % MOD
# print (ans)