import numpy as np

N = int(input())
numbers = list(map(int,input().split(" ")))

count = 0

for i in range(N):
    for j in range(i+1,N):
        pair = (numbers[i]^numbers[j])
        #print(pair)
        count += pair
        
print(count%(10**9+7))