import itertools

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

count = 0

conv = list(itertools.combinations(numbers, r=2))

for j in conv:
    pair = (j[0]^j[1])
    count += pair
        
print(count%(10**9+7))
