num = int(input())

arr = list(map(int,input().split()))

ans = 0

for i in range(0,num-1):
    for j in range(i+1,num):
        c = arr[i] ^ arr[j]
       
        ans += (c % 1000000007)
        

print(ans% 1000000007)