import sys
input = sys.stdin.readline
N = int(input())
A = tuple(map(int,input().split()))
b = 0
c = N-1
num = 1000000007
for i in range(c):
    for j in range(i+1,N):
        b += A[i] ^ A[j]
print(b%num)
