import itertools
import numpy as np
N = int(input())
w = [int(x) for x in input().split()]
x = [balls for balls in itertools.combinations(w, 2)] 
def XOR(x):
    return x[0] ^ x[1]
count = list(map(XOR, x))
result = sum(count) % (10**9+7)
print(result)