import math
N = int(input())
A = [int(i) for i in input().split()]
#print(A)
ans1 = 0 
for i in range(0,N-1):
    for j in range(i+1,N):
        #print(A[i])
        #print(A[j])
        ans1 = ans1 + (A[i]^A[j])
print(ans1 % (10**9 + 7))